SqlCommand commanduser = new SqlCommand("SELECT * from Users WHERE Username = @Username", cs); commanduser.Parameters.Add("@Username", SqlDbType.NVarChar); commanduser.Parameters["@Username"].Value = username.Text; SqlDataAdapter dataAdapteruser = new SqlDataAdapter(commanduser); DataTable dataTableuser = new DataTable(); dataAdapteruser.Fill(dataTableuser); userid.username = (String)dataTableuser.Rows[0]["Username"];
public class User { public User() { } private string username; public string Username { get { return username; } set { username = value; } }
if (dataTableuser.Rows.Count <= 0) { // there are no rows to play with... }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)