Click here to Skip to main content
15,897,334 members

is this code is corerct to retrive the data into text box

Revision 2
public string user(AddInfoModel info)
        {
             SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConsString"].ConnectionString);
             con.Open();
             SqlCommand cmd = new SqlCommand("Resource_sp", con);
             cmd.CommandType = CommandType.StoredProcedure;
             SqlDataReader reader = cmd.ExecuteReader();
             if (reader.Read())
                {

                    FirstName.Text = reader["FirstName"].ToString();
                    LastName.Text = reader["LastName"].ToString();
                    reader.Close();

                    con.Close();
                }
            }
        }
    }
Posted 18-Jan-13 22:21pm by Dhritirao's.
Tags: