emaduddeen
Well-known member
- Joined
- May 5, 2010
- Messages
- 171
- Location
- Lowell, MA & Occasionally Indonesia
- Programming Experience
- Beginner
Hi Everyone,
I need help in the syntax to pass parameters to an MS Access query.
Here is the code I use. It works in SQL Server but fails with a "No value given for one or more required parameters" error.
I'm assuming SQL Server syntax does not work with MS Access even though they are both Microsoft databases.
Can you tell me what the MS Access syntax for this code should be?
Thanks.
Truly,
Emad
I need help in the syntax to pass parameters to an MS Access query.
Here is the code I use. It works in SQL Server but fails with a "No value given for one or more required parameters" error.
I'm assuming SQL Server syntax does not work with MS Access even though they are both Microsoft databases.
VB.NET:
' Create the SQL String for the text boxes.
'------------------------------------------
strSQL = "Select ID, FirstName, MiddleName, LastName, " & _
" Format(RingSizeLeft, ""#0.00"") AS [RingSizeLeft], " & _
" Format(RingSizeRight, ""#0.00"") AS [RingSizeRight] " & _
"From Customers " & _
"Where ID = @CustomerID"
' Create an instance of the data adapter and then fill with data.
'----------------------------------------------------------------
objDataAdapterCustomerDetails = _
New OleDbDataAdapter(strSQL, objConnection)
' Get query results into the Data Set.
'-------------------------------------
objDataAdapterCustomerDetails.Fill(objDataSetCustomerDetails, _
"CustomerDetails")
' Add the parameter to the parameters collection of the Details Data Adapter.
'----------------------------------------------------------------------------
objDataAdapterCustomerDetails.SelectCommand.Parameters.Add("@CustomerID", SqlDbType.Int)
Can you tell me what the MS Access syntax for this code should be?
Thanks.
Truly,
Emad