G
Guest
I am getting Null Exception error when I try to fill a dataset. I am
providing a value for my parameter so I'm not sure, what's going on. Please
see below.....
Thanks
Dim cmd1 As OleDbCommand = New OleDbCommand
cmd1.Parameters.Add("@adate", OleDbType.DBDate)
cmd1.Connection = mycnn
cmd1.CommandType = CommandType.Text
cmd1.CommandText = "SELECT * FROM Mytable WHERE adate = @adate"
MsgBox(cmd1.CommandText.ToString)
Dim ds As DataSet = New DataSet
Dim da As Data.OleDb.OleDbDataAdapter = New
Data.OleDb.OleDbDataAdapter
da.SelectCommand = cmd1
cmd1.Parameters("@adate").Value = #1/3/2005#
Try
da.Fill(ds, "Mytable")
Catch ex As OleDbException
MsgBox(ex.Message)
End Try
providing a value for my parameter so I'm not sure, what's going on. Please
see below.....
Thanks
Dim cmd1 As OleDbCommand = New OleDbCommand
cmd1.Parameters.Add("@adate", OleDbType.DBDate)
cmd1.Connection = mycnn
cmd1.CommandType = CommandType.Text
cmd1.CommandText = "SELECT * FROM Mytable WHERE adate = @adate"
MsgBox(cmd1.CommandText.ToString)
Dim ds As DataSet = New DataSet
Dim da As Data.OleDb.OleDbDataAdapter = New
Data.OleDb.OleDbDataAdapter
da.SelectCommand = cmd1
cmd1.Parameters("@adate").Value = #1/3/2005#
Try
da.Fill(ds, "Mytable")
Catch ex As OleDbException
MsgBox(ex.Message)
End Try