I have a problem wanting to generate reports from a database that is on a server, what happens is that when I perform local tests, I can generate the reports without problems, but when I try to assign it to the "ServerName" parameter in my code a server name that contains an ip address throws me the following error:
Security is integrated, so I do not require access data. the connection to the database is presented without problems, because I can perform procedures for saving, deletion and updating, the problem arises when wanting to generate the reports. then a fragment of the code.
linea = objReader.ReadLine()
Dim a As Integer = InStr(13, linea, "=", CompareMethod.Text) + 2
Dim b As Integer = InStr(a, linea, ";", CompareMethod.Text)
Dim dbase As String = Mid(linea, a, b - a)
linea = objReader.ReadLine()
objReader.Close()
Dim crConInfo As New ConnectionInfo
Dim crLogInfo As New TableLogOnInfo
With crConInfo
.ServerName = linea
.DatabaseName = dbase '"Data"
.IntegratedSecurity = True
.Type = ConnectionInfoType.Query
End With
crLogInfo.ConnectionInfo = crConInfo
Try
Dim fechaInicio As String = Format(Date.Parse(txtFechaInicial.Text), "yyyy-MM-dd")
Dim fechaFin As String = Format(Date.Parse(txtFechaFinal.Text), "yyyy-MM-dd")
If cmbProceso.Text = "Despacho" Then
If cmbReporteTipo.Text = "Simple" Then
'Dim ReportePlanta As New objeto
For Each tabla As Table In Objeto.Database.Tables
crLogInfo = tabla.LogOnInfo
crLogInfo.ConnectionInfo.ServerName = "192.30.1.29\MSSQLSERVER"
crLogInfo.ConnectionInfo.DatabaseName = dbase
tabla.ApplyLogOnInfo(crLogInfo)
Next
Objeto.Refresh()
At the end of the whole operation I end with the following lines.
Formulario.CrystalReportViewer1.ReportSource = Objeto
Objeto.Refresh()
If Formulario.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Formulario.Close()
End If
Could someone help me by telling me what is the proper procedure to generate reports from a database that is on a server? Thank you in advance for the help you can give me.