Im using VB.NET 2005
i want to sum two records in database. So when i retreive them
to display in my textbox they already sum.
the numbers are in text.

please help me ... im a newbie..

this is my code.

con.Open()
cmd = New OleDbCommand("select * from ChargedItems where name ='" & Me.cmbfnameEarnings.Text & "'", con)
conreader = cmd.ExecuteReader
Me.txtcharg.Clear()

Do While conreader.Read

Me.txtcharg.Text = conreader.Item("amount")

Me.Refresh()
Loop
cmd.Dispose()
con.Close()
conreader.Close()

Do While conreader.Read
Me.txtcharg.Text = conreader.Item("amount") + conreader.item("Valuetoadd")

or

Me.txtcharg.Text = conreader.Item("Field1") + conreader.Item("Field2")

ahmm, i want to sum two amount with the same names.

Change ur Query to get one value after adding

Select Fileld1+Field2 as ColumnName from Table where conditon

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.