Click here to Skip to main content
15,915,501 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...
i am developing the report management system.. i want when i choice the client id the particular client balance amount only display the one textbox... like this



Client name / client id / total amount / balance amount

sathish / 1 / 10000 / 5000
ravi / 2 / 5000 / 1000
sathish / 1 / 10000 / 2000
sathish / 1 / 4000 / 200
kumar / 3 / 5000 / 0
raj / 4 / 1000 / 0


when i choice client id 1 means the total balance amount 7200 to be display textbox 1


pls help me..


i do it but that value is display one grid view i wand it display one textbox
My code


con = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=D:\Programs\sathish\sample\sample.mdb")
con.Open()
cmd = New OleDbCommand("select Sum(salary) from q where id=" & TextBox1.Text, con)
adp = New OleDbDataAdapter(cmd)
ds.Clear()
adp.Fill(ds, "q")
DataGridView2.DataSource = ds.Tables(0)
Posted
Updated 2-Aug-13 19:59pm
v2
Comments
sv sathish 3-Aug-13 2:04am    
i try it this code also

Dim str As String = "select SUM(salary) from q where ID=" & TextBox1.Text
Dim cmd As OleDbCommand = New OleDbCommand(str, con)
cmd.Connection = con
Dim dr As OleDbDataReader = cmd.ExecuteReader()

While (dr.Read())
TextBox2.Text = dr("SUM(salary)").ToString()
' TextBox2.Text = str

End While
dr.Close()
' con.Close()
Mr.TMG 4-Aug-13 22:46pm    
What result do you get Using your current sql statement? is it 0?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900