SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Myconstr"].ToString());
SqlCommand cmd = new SqlCommand("sprocUserinfoInsertUpdateSingleItem", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Name", ObjBO.Name);
cmd.Parameters.AddWithValue("@Address", ObjBO.address);
cmd.Parameters.AddWithValue("@EmailID", ObjBO.EmailID);
cmd.Parameters.AddWithValue("@Mobilenumber", ObjBO.Mobilenumber);
con.Open();
int Result = cmd.ExecuteNonQuery();
cmd.Dispose();
// or
con.open();
if (con.State.Equals(ConnectionState.Closed)) con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
con.Close();
return dt;