|
-
Aug 1st, 2000, 08:59 AM
#1
Thread Starter
Fanatic Member
Dear All
This won't work
Code:
cnn.BeginTrans
sSQL = "INSERT INTO tblUsers " _
& "(User_Name, Password, Group) VALUES ('" & txtUserName & "', '" & txtPassword & "', '" & cboGroup & "');"
cnnMIS.Execute sSQL
cnn.CommitTrans
This is what the sSQL string returns
INSERT INTO tblUsers (User_Name, Password, Group) VALUES ('Gary Lowe', 'newpass', 'Admins')
The only other field in the table is an ID field which is an auto number, will this have to be added to the sql string.
The database is access 97 FE = VB6
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Aug 1st, 2000, 09:14 AM
#2
No you should not include the ID if it's an auto numbered field.
What error message do you get?
You use a transaction on a connection object called cnn but you execute the SQL statement on a connection object called cnnMIS, could that be the problem?
Give us some more information and I will be happy to try to answer your question.
Best regards
-
Aug 1st, 2000, 09:19 AM
#3
Thread Starter
Fanatic Member
Joacim
The connection objects in the code are all cnnMIS, I was just trying to make it look general.
The error that keeps coming up is:
-2147217900
Syntax error in INSERT INTO statement.
I can't see anything wrong with the SQL though.
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Aug 1st, 2000, 09:50 AM
#4
I believe that VB-SQL is getting confused by your use of "Group" as a field name. Try changing it to something like "GroupName".
-
Aug 1st, 2000, 10:54 AM
#5
Thread Starter
Fanatic Member
Thanks Martin
That worked
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|