hi there, the problem is....when i display all records of products table, it shows all the record. however , when i try to display some of them , it show the error , i dont know how ti fix, anyone helps me ? thanx
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data " %>
<%@ import Namespace="System.Data.OleDb " %>
<script runat="server">
' Insert page code here
'
Sub Page_Load(Sender As Object, E As EventArgs)
Dim connectionString As String
Dim queryString As string
Dim data As new DataSet()
Dim dbConnection As OleDbConnection
Dim dataAdapter As OleDbDataAdapter
''''''
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=D:\assign2\db1.mdb"
queryString = "SELECT [products].[prod_image], [products].[prod_name], [products].[prod_desc], [products].[pro_price] FROM [product_categories] LEFT JOIN [products] ON [product_categories].[prod_id]=[products].[prod_id] WHERE [product_categories].[cat_id] = 12345"
'open the connection
dbConnection = new OleDbConnection(connectionString)
dataAdapter = new OleDbDataAdapter(queryString, dbConnection)
'fill the dataset with data
dataAdapter.Fill(data,"products")
'bind the date grid to the data
DataGrid.DataSource = data.Tables("products")
DataGrid.DataBind()
ENd sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:DataGrid id="DataGrid" runat="server" HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana" CellPadding="3" BorderColor="Black" BackColor="#CCCCFF" Width="800px" Font-Names="Verdana">
<HeaderStyle backcolor="#AAAADD"></HeaderStyle>
<Columns>
<asp:TemplateColumn SortExpression="khai" HeaderText="Add to Cart" FooterText="khai">
<ItemTemplate>
<asp:Button runat="server" Text="Add To Cart" CommandName="Select" CausesValidation="false" id="btnAdd" ></asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>
this is an 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 25:
Line 26: 'fill the dataset with data
Line 27: dataAdapter.Fill(data,"products")
Line 28:
Line 29: 'bind the date grid to the data
Source File: D:\assign2\laptop.aspx Line: 27
Stack Trace:
[OleDbException (0x80040e10): No value given for one or more required parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +122
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior) +69
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36
ASP.laptop_aspx.Page_Load(Object Sender, EventArgs E) in D:\assign2\laptop.aspx:27
System.Web.UI.Control.OnLoad(EventArgs e) +55
System.Web.UI.Control.LoadRecursive() +27
System.Web.UI.Page.ProcessRequestMain() +731