vb2005水晶報表問題,請指導,急!!!
這是以前2003的代碼,但現在2005就不行.請達人指點.
Private Sub get_list(ByRef g_check As Boolean)
open_cn()
mydst.Clear()
mydst2.Clear()
Try
Dim ex As Exception
Dim mydad As SqlDataAdapter
Dim selectcm1 As String = "select id,proname,tol,tolup,datet,dateup,remark from prtlist"
mydad = New SqlDataAdapter(selectcm1, cn)
mydad.Fill(mydst, "list1")
Dim g_id As Long
Dim g_proname As String
Dim g_tol As Double
Dim g_tolup As String
Dim g_datet As Date
Dim g_dateup As String
Dim g_remark As String
Dim fxmlpath As String
'fxmlpath = Application.StartupPath & "list.xsd"
fxmlpath = "g:wprtckwprtckindebuglist.xsd"
mydst2.ReadXmlSchema(fxmlpath)
mydst2.Tables(0).Rows.Clear()
Dim i As Integer
For i = 0 To mydst.Tables(0).Rows.Count - 1
With mydst.Tables(0)
If i >= 0 Then
g_id = .Rows(i).Item("id")
g_proname = .Rows(i).Item("proname")
g_tol = .Rows(i).Item("tol")
g_tolup = .Rows(i).Item("tolup")
g_datet = .Rows(i).Item("datet")
g_dateup = .Rows(i).Item("dateup")
g_remark = .Rows(i).Item("remark")
End If
End With
Dim myrow As DataRow
myrow = mydst2.Tables("list").NewRow()
myrow("id") = g_id
myrow("proname") = g_proname
myrow("tol") = g_tol
myrow("tolup") = g_tolup
myrow("datet") = g_datet
myrow("dateup") = g_dateup
myrow("remark") = g_remark
mydst2.Tables("list").Rows.Add(myrow)
'mydst1.WriteXml(fxmlpath)
Next i
Dim reportdocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument
'mydst1.ReadXml(fxmlpath)
'reportdocument1.Load(Application.StartupPath & "list.rpt")
reportdocument1.Load("g:wprtckwprtckindebuglist.rpt")
reportdocument1.SetDataSource(mydst2.Tables("list"))
reportdocument1.Refresh()
Me.CrystalReportViewer1.ReportSource = reportdocument1
Me.CrystalReportViewer1.RefreshReport()
g_check = True
Catch ex As Exception
g_check = False
MessageBox.Show(ex.ToString, "Error")
End Try
End Sub
|