dharmang1910
New member
- Joined
- Mar 25, 2017
- Messages
- 4
- Programming Experience
- Beginner
Hello,
I'm new to vb.net and I'm trying to make a simple application of a daily cash register. It calculate the total of the cash according to denomination of the currency and store them to the database. In this application there is a textbox named textbox1 which calculate the total of the cash and display it.Its code is like
I want this total value to add into my database's total column but i can't able to do this. I have attached my other textbox and datagridview to the database with help of wizard but can not do the total thing.Here is my code, Please help me to correct this.
I'm new to vb.net and I'm trying to make a simple application of a daily cash register. It calculate the total of the cash according to denomination of the currency and store them to the database. In this application there is a textbox named textbox1 which calculate the total of the cash and display it.Its code is like
VB.NET:
100*val(textbox2.text)+50*val(textbox3.text)+.....
I want this total value to add into my database's total column but i can't able to do this. I have attached my other textbox and datagridview to the database with help of wizard but can not do the total thing.Here is my code, Please help me to correct this.
VB.NET:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
OpeningCashBindingSource.AddNew()
Dim vartot As Integer = TextBox1.Text
Dim cnt As New OleDb.OleDbConnection
Dim cmt As New OleDb.OleDbCommand
cnt.ConnectionString = "provider = microsoft.jet.oledb.4.0; data source=|DataDirectory|\teller.mdb"
cnt.Open()
cmt.Connection = cnt
cmt.CommandText = "INSERT INTO `Opening Cash` (`Total`) values (" & vartot & ")"
cmt.ExecuteNonQuery()
cnt.Close()
End Sub