4
Reply

error No value given for one or more required parameters.

VINAY KUMAR

VINAY KUMAR

Feb 24 2017 11:47 AM
239
 
string value2 = ddSELCT.SelectedItem.Text;
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\TecbuzzDb\techdb.accdb");
// con.Open();
// OleDbCommand cmd = new OleDbCommand("select Student_name from studentregistration where " + value2 + " ='" + txtseach.Text + "'", con);
// OleDbDataAdapter da = new OleDbDataAdapter(cmd);
// DataSet ds = new DataSet();
// da.Fill(ds);
// GridView2.DataSource = ds;
// GridView2.DataBind();
 
i have one textbox and one dropdown box ..
i want to dispaly studentdetails in gridview  when iam select student_name or Mobile
 
when iam search i got error like below ................
 

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 42:             OleDbDataAdapter da = new OleDbDataAdapter("select * from studentregistration where Student_name=" + DropDownList1.SelectedItem.Text + "", con); Line 43:             DataSet ds = new DataSet(); Line 44:             da.Fill(ds); Line 45:             GridView2.DataSource = ds.Tables[0]; Line 46:             GridView2.DataBind();
 
 
 


Answers (4)