Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Database Programming Made Easy

This tutorial will teach you step by step on how to connect and manipulate database. If you'd like to suggest a tutorial please write a comment at the bottom of this article.

Read more...

Hire Us to Do Your Work

Do you want a customized system? Do you want to setup your own website to do business? Then we are here to help you in your programming needs.

Read more...

Search

Syntax Error (missing operator) VB2005
No replies
User offline. Last seen 26 weeks 3 days ago. Offline
Joined: 02/28/2010


I have my fields set up in my .mdb as follows:

Number - (Autonumber)
Product
Todays Date
Date Created
Product Lifetime

The date fields are NOT set up as dates for right now, I wanted to make sure everything else was working ok.

I'm dealing with updating the fields with a combobox that allows the user to select which record they want to edit. The code for the combo box is:

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
ds.Tables(0).PrimaryKey = New DataColumn() {ds.Tables(0).Columns("Number")}
Dim row As DataRow
row = ds.Tables(0).Rows.Find(ComboBox1.Text)
txtNumber.Text = row("Number")
txtProduct.Text = row("Product")
txtTodaysDate.Text = row("Todays Date")
txtDateCreated.Text = row("Date Created")
txtProductLifetime.Text = row("Product Lifetime")
txtNumber.ReadOnly = True
btnClear.Enabled = False
btnAdd.Enabled = False
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub

The code containing the error is contained in this block of code for "btnEdit"

Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
Try
Dim com As New OleDbCommand
com.Connection = con
com.CommandText = "UPDATE ProductInfo SET [Product]='" & txtProduct.Text & _
"',[Todays Date]='" & txtTodaysDate.Text & "',[Date Created]='" & _
txtDateCreated.Text & "',[Product Lifetime]=" & txtProductLifetime.Text & _
"Where [Number]=" & ComboBox1.Text
com.ExecuteNonQuery()
MsgBox("Record Updated!")
KS_Connect()
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub

I have included a .jpg showing the exact error... I would appreciate any help very much!!! Thanks.


AttachmentSize
_0Error.jpg41.85 KB


Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Step by Step Java Tutorial

In this tutorial you will learn how to program with Java. It has a rich of information to be educated well with Java.

Read more...

Do You Have Question?

Do you have any question related to computer programming? Visit our forum and post new topic on the category you like. Be gentle when asking a question.

Ask now...

Point of Sale

Point of Sale is very useful especially for supermarkets or restaurants. I have included a barcode scanner in this program. Please check it out.

Read more...