referencia a objeto no establecida como instancia de un objeto
Publicado por Josep (11 intervenciones) el 11/05/2017 12:58:27
Buenos dias, tengo este procedimiento y me da el siguiente error: "referencia a objeto no establecida como instancia de un objeto". No logro encontrar la solución. Me pueden ayudar. Gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Private Sub printPreviewButton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles printPreviewButton.Click
Dim connetionString As String = Nothing
Dim connection As SqlConnection
Dim command As SqlCommand
Dim adapter As New SqlDataAdapter()
Dim sql As String = Nothing
connetionString = "Data Source=Josep-Pc\sqlexpress;Initial Catalog=Desplacaments;Integrated Security=SSPI;"
Sql = "select id, data, idorigen, iddesti, km from Viatge"
connection = New SqlConnection(connetionString)
Try
connection.Open()
Command = New SqlCommand(Sql, connection)
adapter.SelectCommand = command
adapter.Fill(ds)
Catch ex As Exception
MessageBox.Show("No es pot obrir!")
End Try
Dim oRpt As New ReportDocument()
oRpt.Load("C:\Users\Josep\Desktop\report_nou.rpt")
oRpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = oRpt
End Sub
Valora esta pregunta


0