alright, first of all i love thise site, helped me out alot alreaddy, but now i have a problem witch i cant find a answer to after a LONG time of searching.
I am trying to make a small search, witch will search true my database table called "serials" in the colum "SoftwareNa me" for a match. but im having the biggest trouble in making it work. this is my code atm:
and i am getting this error:
this is line 80:
im desperate, that has nothing to do with my query! :S please help me out
Richard S
I am trying to make a small search, witch will search true my database table called "serials" in the colum "SoftwareNa me" for a match. but im having the biggest trouble in making it work. this is my code atm:
Code:
protected void btn_search_Click(object sender, EventArgs e)
{
string search = box_searchfor.Text;
string constring = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath("database.mdb");
string SQLvraag = "SELECT * FROM serials WHERE SoftwareName= " + "box_searchfor.Text";
OleDbConnection dbconnectie = new OleDbConnection(constring);
// show the search results
try
{
dbconnectie.Open();
OleDbCommand cmd = new OleDbCommand(SQLvraag, dbconnectie);
OleDbDataReader dr = cmd.ExecuteReader();
lbl_result.Text = "";
if (dr.HasRows)
{
while (dr.Read())
{
lbl_result.Text += dr["SoftwareName"].ToString() + "<br /> ";
}
}
else
{
lbl_result.Text = "Geen serial's gevonden.";
}
}
catch (Exception ex)
{
lbl_result.Text = "Probleem met database" + "<br /><br />" + ex.ToString();
}
finally
{
dbconnectie.Close();
}
}
Code:
System.Data.OleDb.OleDbException: Waarden voor een of meer vereiste parameters ontbreken. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteReader() at _Default.btn_search_Click(Object sender, EventArgs e) in d:\Mijn Documenten\Visual Studio 2005\WebSites\Richards project\Seriallist.aspx.cs:line 80
Code:
OleDbDataReader dr = cmd.ExecuteReader();
Richard S
Comment