protected void btnShow_Click(object sender, EventArgs e) { string conStr = ConfigurationManager.ConnectionStrings["CStringCRM"].ToString(); DataTable dt = new DataTable(); SqlDataReader dr = null; using (SqlConnection conn = new SqlConnection(conStr)) { // Creating insert statement string sql = string.Format(@"SELECT * FROM UserInfo"); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = sql; cmd.CommandType = CommandType.Text; conn.Open(); dr = cmd.ExecuteReader(); dt.Load(dr); conn.Close(); cmd = null; } GView.DataSource = dt; GView.DataBind(); txtFName.Text = dr["UFName"].ToString(); }
txtFName
txtFName.Text = dr["UFName"].ToString();
ExecuteReader()
Select * from table name
dt.Rows[0]["UFName"].ToString();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)