When write this code...
===================
/SqlConnection Connection = Connection.Open();
SqlCommand Comm = new SqlCommand();
//Comm.Connection = Conn;
Comm.CommandType = CommandType.Text;
Comm.CommandText = "Insert Into customer (Emailid,Password,Userid,Add1,State,City,Pin,Title,Fname,Lname,Gender,Dob,Mobile,Regidate) " + " values('" + txtEmailid.Text + "','" + MyPwd + "','" + txtEmailid.Text + "','" + txtAdd1.Text + "','" + cmbState.SelectedItem.Text + "','" + txtCity.Text + "'," + txtPin.Text + ",'" + CmbTitle.SelectedItem.Text + "','" + txtFname.Text + "','" + txtLname.Text + "','" + cmbGender.SelectedItem.Text + "','" + BodDate.SelectedDate.Date + "'," + txtMobile.Text + ",'" + System.DateTime.Today + "')";
Comm.ExecuteNonQuery();
//SqlConnection Connection = Connection.Close();
Adpt = new SqlDataAdapter("select * from customer", Connection);
Dataset1 = new DataSet();
Adpt.Fill(Dataset1, "customer");
EmptyControls();
================================
the insert in to qrety line in command.commantext will give this error
object reference is not set to an instance of the object
plz solve my problem as early as possible..
Thanks in advacne
Shah Shishir
Loading
Ryan AlfordPosted Oct 3, 2008, 4:10 PM
AlanPosted Oct 3, 2008, 6:37 AM
The most likely explanation is that one of your comboboxes doesn't have a selected item.
I'd examine the value of each variable on that line using the debugger (just hover your mouse over it) so you can see which one is null.