JT_SIRO
asked on
How do I get field values for one row
This should be simple, but I'm forgetting how to simply look up a record by ID, then access the individual field values in asp.net. The code below isn't working. What's the proper way to do this?
strSQL = "select FIRST, LAST, PHONE from [EMP] where [EID] = 7104";
strConnString = ConfigurationManager.ConnectionStrings["MY_CONNECTION"].ConnectionString;
conn = new SqlConnection(strConnString);
cmd = new SqlCommand(strSQL, conn);
conn.Open();
SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);
if (dr.HasRows)
{
txtFIRST.Text = dr.GetString(0);
txtLAST.Text = dr.GetString(1);
txtPHONE.Text = dr.GetString(2);
}
dr.Close();
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.