V
Viravalo
Guest
Hey guys, I need help with Crystal Reports.
I'm trying to generate reports from a remote database using a connection string. Everyting is working okay with the connection, it's just with the reports the problem.
I have a stored procedure in my sql database with one parameter. I'm using Crystal's wizard to make a local connection to bring the stored procedure, but by code, I'm giving it my connection string saved in mysettings.
Dim svrcon = My.Settings.ServerCon
Dim cn As New SqlConnection(svrcon)
Try
Dim dt As New DataTable
Dim iden As String = TextBox1.Text
Using cn As New SqlConnection(svrcon)
cn.Close()
Using query As New SqlCommand("BSolicitante_Reportes @id = '" & iden & "'", cn)
cn.Open()
Dim reader As SqlDataReader = query.ExecuteReader
dt.Load(reader)
Dim rpt As New RptPrueba_2
rpt.SetParameterValue("@id", iden)
CrystalReportViewer1.ReportSource = rpt
End Using
End Using
Catch ex As Exception
MessageBox.Show("Error: " & ex.ToString)
End Try
The parameter is taken from textbox1.text.
"BSolicitante_reportes" is my stored procedure.
Once I try to generate the report from a client PC, it shows me the database login...
THE LOGIN IMAGE: https://social.msdn.microsoft.com/Forums/getfile/1423754
Please help!
Continue reading...
I'm trying to generate reports from a remote database using a connection string. Everyting is working okay with the connection, it's just with the reports the problem.
I have a stored procedure in my sql database with one parameter. I'm using Crystal's wizard to make a local connection to bring the stored procedure, but by code, I'm giving it my connection string saved in mysettings.
Dim svrcon = My.Settings.ServerCon
Dim cn As New SqlConnection(svrcon)
Try
Dim dt As New DataTable
Dim iden As String = TextBox1.Text
Using cn As New SqlConnection(svrcon)
cn.Close()
Using query As New SqlCommand("BSolicitante_Reportes @id = '" & iden & "'", cn)
cn.Open()
Dim reader As SqlDataReader = query.ExecuteReader
dt.Load(reader)
Dim rpt As New RptPrueba_2
rpt.SetParameterValue("@id", iden)
CrystalReportViewer1.ReportSource = rpt
End Using
End Using
Catch ex As Exception
MessageBox.Show("Error: " & ex.ToString)
End Try
The parameter is taken from textbox1.text.
"BSolicitante_reportes" is my stored procedure.
Once I try to generate the report from a client PC, it shows me the database login...
THE LOGIN IMAGE: https://social.msdn.microsoft.com/Forums/getfile/1423754
Please help!
Continue reading...