This is the code on the print command and the dataset connected with database successfully
Try
Dim rpt As New rptallergy2
Dim myConnection As SqlConnection
Dim MyCommand1 As New SqlCommand()
Dim myDA1 As New SqlDataAdapter()
Dim myDS As New DataSet
myConnection = New SqlConnection(cs)
MyCommand1.Connection = myConnection
MyCommand1.CommandText = "SELECT RTRIM(patient.name) from patient "
MyCommand1.CommandType = CommandType.Text
myDA1.SelectCommand = MyCommand1
myDA1.Fill(myDS, "patient")
rpt.SetDataSource(myDS)
frmReport.CrystalReportViewer1.ReportSource = rpt
frmReport.ShowDialog()
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
MyCommand1.CommandText = "SELECT RTRIM(patient.name) as pName from patient"
Then match the pName
field to the field on your crystal reports is what Jonathan Willcock was saying.