|
can anyone tell how to pull the data in my table to crystal report. example,i loggedin,date and time will be saved on my table.the report must display the time i logged in. this is my code in my form
If ComboBox1.Text = "Shift 1" Then
Dim rpt As New EndofShift() 'The report you created.
Dim MyCommand As New SqlCommand()
Dim myDS2 As New loghistory() 'The DataSet you created.
Dim myDA2 As New SqlDataAdapter()
Dim myDS As New DSactualguesting() 'The DataSet you created.
Dim myDA As New SqlDataAdapter()
Dim cn As New SqlConnection(ConnectString())
Try
MyCommand.Connection = cn
MyCommand.CommandText = "Select * from actualguesting"
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "actualguesting")
myDA.SelectCommand.CommandText = "Select * from loghistory where username='" + Login.txtuser.Text + "'"
myDA.Fill(myDS, "loghistory")
myDS.EnforceConstraints = False
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
Edited by chester - 11 Jun 2013 at 5:34pm
|