aditya immadi

aditya immadi

  • 1.7k
  • 205
  • 60k

Object Reference not set to an Instance of an Object.Error

Sep 17 2013 1:44 PM
       string constring = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
            SqlCommand cmd = new SqlCommand();
            SqlConnection conn = new SqlConnection(constring);
            cmd.Connection = conn;

            cmd.CommandText = "sp_insert_data";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@decription", txtdesr.Text);
            cmd.Parameters.AddWithValue("@url", txturl.Text);
            SqlDataReader dr = cmd.ExecuteReader();

Hai all,
        i want to insert "name"(user can't enter his name in this page we need to retrieve from sessions).at the time i have this error Object reference not set to an instance of an object
how can i overome this

Thanks and Regards

Brought to you by: JavaScript SDK for Bold BI dashboard and analytics embedding. Free trial.

Answers (3)