I am trying to display the list of cars that are provided by the dealer Toyota in a Gridview
I get the information from a database called Dealership.accdb The name of the table is Table1 The table has two columns dealer and car
But I keep getting this error "Additional information: No value given for one or more required parameters."
The code works fine when I use it to display the list of "dealers" But when I try to display the list of cars provided by the dealer it shows the error I mentioned above
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public partial class toyota : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection connect = new OleDbConnection();
connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:\Users\Student\Documents\Visual Studio 2013\WebSites\WebSite1\Dealership.accdb";
connect.Open();
OleDbCommand cmd = new OleDbCommand("SELECT Car FROM Table1 WHERE dealer = Toyota", connect);
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
adapter.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}