Bonus card points problem with code vb 2005

I have this code  in order formprovide  by an expert(Thnks so much) the use of this code is when  a customer buy something from the store and have a bonus card  to  update the points of his her bonuscard.

I try it and is ok but i get error

dbcmd.CommandText = "Update Bonuses Set Points = Points+ " & Totalorder & " Where CardNo = " & BonusCardTextBox1.Text
dbcmd.ExecuteNonQuery()

What is Update bonuses is a table is somthing else please some one help

My points is pointstextbox.text my bonuscarnumber=BonusCardTextBox1.Text and the Totalorder is  TotalorderTextbox.text
Private Sub OrdersDetailsBindingSourceBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.OrdersDetailsBindingSource.EndEdit()
        Me.OrdersDetailsTableAdapter.Update(Me.NicolaouDBDataSet.OrdersDetails)
        Me.OrdersDetailsDataGridView.Refresh()
        TotalSum()
        If BonusCardTextBox1.Text.Length > 0 Then
 
            Dim Totalorder As Integer = Integer.Parse(TotalorderTextBox.Text)
            Dim dbcon As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0; Data " & "Source = D: NicolaouDb.mdb ; User Id = ; " & _
"Password = ")
            dbcon.Open()
            Dim dbcmd As New OleDb.OleDbCommand
            dbcmd.Connection = dbcon
            dbcmd.CommandText = "Update Bonuses Set PointsTextBox = PointsTextBox + " & Totalorder & " Where CardNo = " & BonusCardTextBox1.Text
            dbcmd.ExecuteNonQuery()
        Else
            MessageBox.Show("You could have earned " & Integer.Parse(TotalorderTextBox.Text) & " points with this order if you had a bonus card.")
        End If
 
    End Sub

Open in new window

LVL 1
demoniumzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GuitarRichCommented:
What is the error message?

You might want to set the CommandType to text like this:


dbcmd.CommandType = CommandType.Text

Open in new window

0
GuitarRichCommented:
Also is the field in your DB called PointsTextBox or Points? You have PointsTextBox in your SQL

dbcmd.CommandText = "Update Bonuses Set PointsTextBox = PointsTextBox + " & Totalorder & " Where CardNo = " & BonusCardTextBox1.Text

should this be:

dbcmd.CommandText = "Update Bonuses Set Points = Points + " & Totalorder & " Where CardNo = " & BonusCardTextBox1.Text

?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
demoniumzAuthor Commented:
Data type mismatch in criteria expression

"Update Bonuses Set Points

What is Bonuses is a table is something else i dont understand it
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

demoniumzAuthor Commented:
also  now i see that totalorder that is exist  in the database have no value inside the ms access database 2003
0
GuitarRichCommented:
Update Bonuses Set Points = Points + " & Totalorder & " Where CardNo = " & BonusCardTextBox1.Text

Bonuses should be a table in your database for this sql to work.
It should have at least 2 fields - Points and CardNo, from this is looks like CardNo is the primary key.

TotalOrder is an integer value that is retrieved in the above code from the TotalorderTextBox control which I assume is on your form.
0
demoniumzAuthor Commented:
Listen me i have then  table Customers inside of this table i have The Points and Bonuscard

Now i am  in the Orderdetails form that save and take data from the Total order is in integer but when  i  save the data i have in the datagridview and give me the result,the result is not saved in the orderdetails table

how i can  save the Totalorder in the database?
0
demoniumzAuthor Commented:
No value given for one or more required parameters. .The field that have not value is Totalorder i  am not able to save it in the database the result can u  explain me help me save this
0
demoniumzAuthor Commented:
original solution provided by jpaulino in a similar question  but helping me  GuitarRich so is fair to  accepted  as solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.