Put Data from a table to a label
Hello, i have this code
Saludos, tengo el siguiente codigo.
SqlDataSource sds = new SqlDataSource();
sds.ConnectionString = ConfigurationManager.ConnectionStrings["DatabaseConnectionString2"].ToString();
sds.SelectParameters.Add("username", TypeCode.String, this.username.Text);
sds.SelectParameters.Add("password", TypeCode.String, this.password.Text);
sds.SelectCommand = "SELECT * FROM [Descuentos] WHERE [ID_DIM] = @username AND [Password] = @password";
DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);
try
{
if (dv.Count == 0)
{
this.lblinfo.ForeColor = System.Drawing.Color.Red;
this.lblinfo.Text = "Numero de DIM o Password incorrecto!";
return;
}
The Table has the next Values: ID_DIM, Nombre, Descuento and Password, i
make a comparation between the DIM and Password in the database (user
and pswd), now i need the "Descuento" (discount) value into a label, to
make an arithmetic operation.
For example, if i am the DIM number 5689, and i have the 35% of discount, put the 35% into the label to make the operation.
any suggestion i will apreciate it (by the way, sorry about my english).