📄 formprint.vb
字号:
Imports CommonDB
Public Class FormPrint
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As New DataSet
Dim str As String = "name,sex ,birthday, marry ,mobile, address, hire_date, work_age, status"
If TextBox1.Text = "" Then
ds = DbBase.DataInterface.Execute4DS("select " & str & " from employee ")
Else
ds = DbBase.DataInterface.Execute4DS("select " & str & " from employee where id=" & CInt(TextBox1.Text))
End If
Dim ds2 As New DataSet2 'DataSet2.xsd文件
Dim dr(ds.Tables(0).Rows.Count - 1) As DataRow
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1 '循环将查询的值给DataSet2.xsd文件
dr(i) = ds2.employee.NewRow
dr(i).Item("name") = ds.Tables(0).Rows(i).Item("name")
dr(i).Item("sex") = ds.Tables(0).Rows(i).Item("sex")
dr(i).Item("birthday") = ds.Tables(0).Rows(i).Item("birthday")
dr(i).Item("marry") = ds.Tables(0).Rows(i).Item("marry")
dr(i).Item("mobile") = ds.Tables(0).Rows(i).Item("mobile")
dr(i).Item("address") = ds.Tables(0).Rows(i).Item("address")
dr(i).Item("hire_date") = ds.Tables(0).Rows(i).Item("hire_date")
dr(i).Item("work_age") = ds.Tables(0).Rows(i).Item("work_age")
dr(i).Item("status") = ds.Tables(0).Rows(i).Item("status")
ds2.employee.Rows.Add(dr(i))
Next
CR11.Load("CR1.rpt")
CR11.SetDataSource(ds2)
CrystalReportViewer1.ReportSource = CR11
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -