hi,
Does anyone know how to accumulate total in sql.I have made a function to add a amount to sql.i wants the amount which i have add to be accumulated in total column in sql.How do i make it work.
please help
Public Function Update_TotalBalance() As Boolean
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim strSQL As String = ""
Dim connStr As String
connStr = "server=(local); database=Credit; Trusted_Connection=yes"
myConnection = New SqlConnection(connStr)
Try
strSQL = "INSERT INTO dbo.RetailerBalance([BoothID], [GrandTotal]) VALUES ('" & Form1.txtBoothID.Text & "','" & frmCurrentBalance.lblBalance.Text & "')"
If myConnection.State = 0 Then
myConnection.Open()
End If
myCommand = New SqlCommand(strSQL, myConnection)
myCommand.ExecuteNonQuery()
myCommand.CommandText = strSQL
Catch e As Exception
MsgBox(Err.Description)
End Try
myConnection.Close()
End Function