Hi all,
I have a drop down list which store all the different brands of
product.When i selected the particular brand from the drop down list, it
will display all the products with the selected brand in a datagrid. I have
this error when i select a brand from the drop down list. Blow is my
code,anyone can help me to solve my error,which part of my code went wrong?
Really thanx and very appreciate your help in advanced.. I have been
stucked for days regarding this error..
This is the error : No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one
or more required parameters.
Source Error:
Line 208: objAdp = New OleDb.OleDbDataAdapter(strSqlCmd, con)
Line 209: dataTable = New DataTable
Line 210: objAdp.Fill(dataTable)
Line 211: dgProducts.DataSource = dataTable
Line 212: dgProducts.DataBind()
Here is the code :
Dim strSqlCmd As String
Dim objAdp As OleDb.OleDbDataAdapter
Dim dataTable As DataTable
Dim brand As String
brand = ddlBrand.SelectedItem.Value
strSqlCmd = "Select p.ProductID, p.ProductName, p.ProductBrand, " & _
"p.ProductImage, p.Price, p.Quantity " & _
"From Product p, CategoryProduct cp Where " & _
"p.ProductID= cp.productID " & _
"and cp.CategoryID=" & Request.QueryString.Get
("CategoryID") & _
"and p.ProductBrand=" & brand
objAdp = New OleDb.OleDbDataAdapter(strSqlCmd, con)
dataTable = New DataTable
objAdp.Fill(dataTable)
dgProducts.DataSource = dataTable
dgProducts.DataBind()
End Sub
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...p-net/200505/1