I'm a senior in high school, and several people in my class are attending the Business Professionals of America National Leadership Confrence at the end of April. I am part of a team competing in the Software Engineering section, and the warehousing program we are building has run into some very vexing problems.
We are writing this in VB.NET with an Access database. The current problem we are running into is with the user administration table and forms. The User table is designed as (field/type-field/type): ID/Autonumber-Username/Text-Password/Text-LName/Text-FName/Text-Admin/Boolean. Our form simply has textboxes for the text fields and a combobox for the boolean value. When we build/run and try to add a user, it throws a syntax error in the following SQL code:
"INSERT INTO Users (Username,Password,LName,FName,Admin) VALUES ('" _
& txtUsername.Text & "','" _
& txtPass1.Text & "','" _
& txtLName.Text & "','" _
& txtFName.Text & "'," _
& "True)" _
Is this not a valid SQL statement? If noone here can find error with that code, then I'll be happy to include more information(Form Code, Database Class, any other suggestions).
Comments
[size=1][COLOR=blue]"Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."[i]1Thess. 5:16-18[/i][/color][/size]
One is 'Users' a reserved word in access? If so that could be your problem. It is a very good programming practice to enclose database tables and values in sqaure Brackets brackets.
Ex:[code] SELECT * FROM [Users]
SELECT * FROM [Users] WHERE [LName] = 'FooBar'[/code]
Cheers,
~rlc
"INSERT INTO Users (Username,[Password],LName,FName,Admin) VALUES ('"
& txtUsername.Text & "','" _
& txtPass1.Text & "','" _
& txtLName.Text & "','" _
& txtFName.Text & "'," _
& "True)" _
this will work.
thank u
Cheers,
~rlc
:
: Cheers,
:
: ~rlc
:
:
Just as a side note.....there are several reserved words in Access and VB.Net that don't show up on a list anywhere....You can call your fields anything else and then change the names to what you want in the DataGrid TableStyles/GridColumnStyles properties.
Regards, Bill