ciao ragazzi, creato oggetto report, riempito con dataset, ora come inserisco i campi del database nel report?
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.OleDb" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.IO" %>
<%@ Import NameSpace="System.Drawing.Text" %>
<%@ Import NameSpace="System.Drawing.Drawing2D" %>
<%@ Import NameSpace="System.Drawing.Imaging" %>
<%@ Import NameSpace="CrystalDecisions.Shared" %>
<%@ Import NameSpace="CrystalDecisions.CrystalReports.Engine" %>
<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<script runat="server">
Dim cn As OleDbConnection
Dim dap As OleDbDataAdapter
Dim dst As DataSet
Dim cmd As OleDbCommand
Dim sql As String
Dim Nome As String, k As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("mdb-database/Dati2.mdb"))
If Not IsPostBack Then
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
dap = New OleDbDataAdapter("select * from Clienti", cn)
dst = New DataSet
dap.Fill(dst, "Clienti")
Dim crystalReport As New ReportDocument()
crystalReport.Load(Server.MapPath("CrystalReport.rpt"))
CrystalReportViewer1.ReportSource = crystalReport
CrystalReportViewer1.Visible = True
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body style="background-color:Black; color:Yellow ">
<form id="form1" runat="server">
<div>
</div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="true" />
</form>
</body>
</html>
Non avendo utilizzato il wizard, non mi mostra i campi del database, ma suppongo che dovrei mettere un campo manuale e dargli il nome corrispondente a quello del dalla tabella che mi interessa.