Unable to execute query.
Hi I am not able to execute following query.
----------------------------------------------
Sub insertrow(Source As Object, e As EventArgs)
dim str as String
dim strTsid as String
dim intTsid as Integer
str = "select max(tsid) from timesheet"
DBCommand = New OleDbCommand(str, DBConnection)
DBReader = DBCommand.ExecuteReader()
while DBReader.Read()
intTsid = DBReader(0) + 1
end while
DBReader.Close()
strTsid = intTsid.toString()
str = "insert into timesheet values(" & strTsid & ",13979," & ProList.SelectedItem.value & "','" & Task.SelectedItem.value & "'," & ActList.SelectedItem.value & "," & WTList.SelectedItem.value & "," & TeamList.SelectedItem.value & "," & Hours.SelectedItem.value &"," & Minutes.SelectedItem.value & ",#" & dt.text & "#,'" & comments.text & "')"
DBCommand = New OleDbCommand(str, DBConnection)
DBReader = DBCommand.ExecuteReader()
end sub
----------------------------------------------
It gives error beacuse not able to get values before "ProList.SelectedItem.value" i.e. ignores "strTsid" and '13979'
Please help.
Rupen Anjaria.:)
------------------
We CAN'T avoid problems, but can solve it.
|