I am passing in a sql string into the function. When it
hits the da.Fill ... I get object reference not set to instance of an object....
Private Sub FillDataGrid(ByVal strSQL)
'-- the filldata grid sub will create a dataset that
'-- will be used to populate a grid
Dim strConn As String = "server=EdsLapTop;database=Voters;" _
& "integrated security=SSPI"
Dim conVoters As New SqlConnection()
conVoters.ConnectionString = strConn
conVoters.Open()
Try
sql = "SELECT * FROM VOTERS "
sql = sql & "WHERE " & strSQL
conVoters = New SqlConnection(strConn)
ds = New DataSet("Voters")
da.Fill(ds, "Voters")
grdVoters.DataSource = ds.Tables(0).DefaultView
Catch ex As Exception
MsgBox("Error: " & ex.Source & " : " & _
ex.Message, MsgBoxStyle.OKOnly, "btnSelect")
End Try
conVoters.Close()
conVoters.Dispose()
End Sub
Thanks for any help on this one...really stumped