Hi,
In my code i want to get values from database based on my textbox value which is greater than that textbox values and display it to another three label
For example in my database
I have fields like,
amount name
1000 bag
2000 watch
3000 mobile
From this if my textbox value is 1000 it will get 2000 and 3000 and display it to two labels respectively.....
Please help.....
Thanks in advance
Loading

Anupam SinghRank #643 · 3.7K reputationPosted Jun 24, 2014, 4:28 AM EDT
and its no need to use datatable if there are only 2 values.
you can try :
Anupam SinghRank #643 · 3.7K reputationPosted Jun 24, 2014, 3:35 AM EDT
sudipta sanyalRank #1,945 · 753 reputationPosted Jun 24, 2014, 3:40 AM EDT
leathu raj72 reputationPosted Jun 24, 2014, 3:54 AM EDT
i tried like this..
for next time i give this same coding based on textbox1... But i works and does not get right value..
..
Anupam SinghRank #643 · 3.7K reputationPosted Jun 24, 2014, 4:01 AM EDT
SqlCommand cmd = new SqlCommand("select gift_points from gift_entry where gift_points >'" + Convert.ToInt32(txt_rewardpoints.Text.Trim()) + "'", con);
By default the value of text box is string type and you might be using int in SQL.
Try this will work.
leathu raj72 reputationPosted Jun 24, 2014, 4:11 AM EDT
but i want to get another two value to two labels.
In my example database like if i give 1000 in my textbox one label will display 2000 and another lable will display 3000 if is possible ... or not...
I am in confusion to solve this...
leathu raj72 reputationPosted Jun 24, 2014, 4:39 AM EDT
Sagar PardeshiRank #103 · 20.8K reputationPosted Jun 24, 2014, 8:21 AM EDT
DataTable tbl; cmd.CommandText = "SELECT * FROM YourTable WHERE [user id]='@a'"; cmd.Parameters.AddWithValue("@a", YourTextBox.Text);
dap.SelectCommand = cmd; dap.Fill(tbl);
if( tbl.Rows.Count > 0 ) //user id is already exist