0
我正在使用Vb.Net 2010開發具有水晶報告CRforVS_13_0的項目。我連接到sqlserver並使用以下步驟填充我的數據集。從vb.net的水晶報表中沒有數據顯示,使用SQL的數據集
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Imports System.Data
Public Class frmPrinTest
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cnn As SqlConnection
Dim connectionString As String
Dim sql As String
Dim MyCommand As New SqlCommand
Dim myDA As New SqlDataAdapter
connectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=stock;Persist Security Info=True;User ID=sa;Password=1234[enter image description here][1];"
cnn = New SqlConnection(connectionString)
sql = "select Icode,Iname from stockInvt"
MyCommand.Connection = cnn
MyCommand.CommandText = sql
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
Dim ds As New DataSet1
myDA.Fill(ds, "stockInvt")
Dim objRpt As New CrystalReport1
objRpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = objRpt
'CrystalReportViewer1.Refresh()
End Sub
End Class
但我不能在我的數據集或數據表中顯示數據在水晶報告。 我也關注這個鏈接。 CrystalReport_ADO_Dataset PDF 請幫幫我。
非常感謝您..您節省了我的時間。 – Tamal