Dear All,
Please see the following subroutine I have created called 'getappointmentnotes'
Public Sub getappointmentnotes(ByVal appnumber As Object, ByRef appointmentnotes As Object)
Dim sql As String
sql = "SELECT appnotes from appointments where appnumber = " & appnumber & ""
da = New OleDb.OleDbDataAdapter(sql, conn)
da.Fill(ds, "tempdataset")
da.Update(ds, "tempdataset")
appointmentnotes = ds.Tables("tempdataset").Rows(0).Item(1)
ds.Tables("tempdataset").Clear()
End Sub
I call this subroutine (from a seperate form) as follows:
bookingscreenform.getappointmentnotes(appnumber, appointmentnotes)
At runtime I get the error 'Conversion from type 'DBNull' to type 'String' is not valid' on the line where I try to set appointmentnotes to equal the item in my dataset.
I suspect that the dataset is not actually being filled by this SQL query as I have used the data adaptor in other parts of my program and indeed the 'tempdataset' ds name. However when I use this previously I issued a ds.Tables("tempdataset").Clear() command, so I'm sure there are not old records in my dataset.
so, does anyone have any ideas what might be causing this error?
many thanks in advance, I am starting to get mildy annoyed with it!!
Please see the following subroutine I have created called 'getappointmentnotes'
Public Sub getappointmentnotes(ByVal appnumber As Object, ByRef appointmentnotes As Object)
Dim sql As String
sql = "SELECT appnotes from appointments where appnumber = " & appnumber & ""
da = New OleDb.OleDbDataAdapter(sql, conn)
da.Fill(ds, "tempdataset")
da.Update(ds, "tempdataset")
appointmentnotes = ds.Tables("tempdataset").Rows(0).Item(1)
ds.Tables("tempdataset").Clear()
End Sub
I call this subroutine (from a seperate form) as follows:
bookingscreenform.getappointmentnotes(appnumber, appointmentnotes)
At runtime I get the error 'Conversion from type 'DBNull' to type 'String' is not valid' on the line where I try to set appointmentnotes to equal the item in my dataset.
I suspect that the dataset is not actually being filled by this SQL query as I have used the data adaptor in other parts of my program and indeed the 'tempdataset' ds name. However when I use this previously I issued a ds.Tables("tempdataset").Clear() command, so I'm sure there are not old records in my dataset.
so, does anyone have any ideas what might be causing this error?
many thanks in advance, I am starting to get mildy annoyed with it!!