Visual Basic .NET Tutorial

Syntax error in UPDATE statement

While I was working with Visual Basic .NET by adding a form to manage user account in my system I found an error called “Syntax error in UPDATE statement”. After figuring out what’s the cause of this error I found out that it was the name of the field that is causing the problem.

In my Users table I have the following fields:

UserID
Password
CompleteName

As you can see all of these fields are valid. The statement to save a record back to its database is:

Auto Generate Key

This tutorial will teach you on how to create a key automatically as a primary key in your table. It is sometimes needed to create your own key to format it on your own needs. Say for example you’d like to format it to start as four (4) digits rather than starting from one (1).

The code herein is based on the code that I have already submitted on some of my program like hotel reservation system. But these time a simplified one. I created this tutorial because there are some visitors in this website who asked this before.

How to Change the Database Password Programmatically?

This tutorial will teach you on how to change the database password of an Access database programmatically using visual basic 6.0.

CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DatabasePath & ";Persist Security Info=False;Mode=12;Jet OLEDB:Database Password="current password here" sqlExecStr = "ALTER Database Password " & txtNewPass & " " & txtOldPass & ";" CN.Execute sqlExecStr

Where CN is your database connection variable.

If you use the database before changing the password be sure to close it by adding code like: