Public Sub rsvrpt()
Dim rpt As New reservationrpt() 'The report you created.
Dim MyCommand As New SqlCommand()
Dim myDA As New SqlDataAdapter()
Dim myDS As New DataSet2() 'The DataSet you created.
Dim cn As New SqlConnection(ConnectString())
Try
MyCommand.Connection = cn
MyCommand.CommandText = "SELECT * FROM maintable where irsno=" + irsn
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "maintable")
myDA.SelectCommand.CommandText = "Select fullname from usertbl where username='" + Login.txtuser.Text + "'"
myDA.Fill(myDS, "usertbl")
myDS.EnforceConstraints = False
rpt.SetDataSource(myDS)
CrystalReportViewer1.ReportSource = rpt
'rpt.PrintOptions.PrinterName = "EPSON LX-300+ /II"
'rpt.PrintToPrinter(1, False, 0, 0)
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error)
End Try
End Sub
Good day sir!, i have this code above which is working on my other form.but when i try to put it on my main form,it always prompt for a database login which is not happening on my second form.what should i do about my code? i already add this code on my app.config
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
.