sqlexception
-
Hi I have written query like: dim str as string="true" Dim cmd As New OleDb.OleDbCommand("Select max(Invoice_No) from Invoice where flag= '" & str & "'", cn) cn.Open If IsDBNull(cmd.ExecuteScalar()) = True Then This statment fires exception:"No value given for one or more required parameters." when i fire this query directly from access,it runs successfully what is actual problem,i don't understand Thanks monika
-
Hi I have written query like: dim str as string="true" Dim cmd As New OleDb.OleDbCommand("Select max(Invoice_No) from Invoice where flag= '" & str & "'", cn) cn.Open If IsDBNull(cmd.ExecuteScalar()) = True Then This statment fires exception:"No value given for one or more required parameters." when i fire this query directly from access,it runs successfully what is actual problem,i don't understand Thanks monika
There are a few possible problem's 1: flag if this is a yes/no field in access (wich I assume it is) then the ' are not allowed so you'r query would be : (Select max(Invoice_No) from invoice where flag=" & str , cn) 2: there could be something wrong with you'r connection (cn) have you tested this? (easy to do with a simple "select invoice_no from invoice") hope this helps
If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistakes.