المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : gettin some error @ run time



C# Programming
08-26-2009, 02:32 PM
string connection1 = ConfigurationManager.AppSettings["conn"];
OleDbConnection con1 = new OleDbConnection(connection1);
con1.Open();
OleDbDataAdapter da = new OleDbDataAdapter();
DataSet ds = new DataSet();


OleDbDataReader dr;

OleDbCommand cmd4 = new OleDbCommand("select count(*) from appointment where DOCTOR_NAME = '" + DropDownList1.SelectedItem + "' ";", con1);
dr = cmd4.ExecuteReader();
if (Convert.ToInt32(dr[0]) != 4)
TextBox4.Text = "hello";

am tryin this code but its showing error in the run time.
the error is
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.

Source Error:


Line 173:
Line 174: OleDbCommand cmd4 = new OleDbCommand("select count(*) from appointment where DOCTOR_NAME = '" + DropDownList1.SelectedItem + "' ", con1);
Line 175: dr = cmd4.ExecuteReader();
Line 176: if (Convert.ToInt32(dr[0]) != 4)
Line 177: TextBox4.Text = "hello";

can u help me out