sama rr

sama rr

  • NA
  • 12
  • 4k

multiply textbox value and sql table coloum

Apr 20 2014 2:38 AM
sql table like below

sno   items        rate
1      chips         5


i want o/p like
i havetwo textboxes 
1st textbox if value 15 ..i wnat multiply texbox1 value  * rate in sql table

if textbox value =15
rate=5

textbox2 value =15*5=75
o/p

textbox2=75
plz write csharp code.....

i am using below quarie but its not working..............

 SqlConnection con = new SqlConnection("");
        SqlDataAdapter da;
        DataSet ds;
        da = new SqlDataAdapter("Select rate from verify ", con);
         ds = new DataSet();
        da.Fill(ds);
        decimal quantity1 = Convert.ToDecimal(ds.Tables[0].Rows[0]["Rate"].ToString());
        var a = Convert.ToDecimal(TextBox1.Text);
        TextBox2.Text = (quantity1 * a).ToString();


Answers (6)