If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Problem with inserting record into access table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-08-04, 02:13
SandyLeang SandyLeang is offline
Registered User
 
Join Date: Jan 2004
Location: Phnom Penh
Posts: 9
Problem with inserting record into access table

Dear All,

Your help would be much appriciated as i could not find the mistake.

I am trying to insert a record into a table in ms access database, but got the syntax error, insert into...

thanks
Attached Files
File Type: zip register.zip (25.6 KB, 12 views)
Reply With Quote
  #2 (permalink)  
Old 01-08-04, 09:26
sivaroo sivaroo is offline
Registered User
 
Join Date: Nov 2003
Posts: 76
try to change your sql to this. HTH

sql = "Insert into tb_user(Username,Password) values(" & "'" & Username & "'" & "," & "'" & password & "'" & ")"
Reply With Quote
  #3 (permalink)  
Old 01-08-04, 11:58
somebodyfree somebodyfree is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
Try this. This should work it is the field name some times it could be a key word. It is always good practice in the database to cover field name in "[]" .


dim sql
sql = "Insert into tb_user([Username],[Password]) values('"
sql = sql & Username & "','"
sql = sql & Password &"')"
Reply With Quote
  #4 (permalink)  
Old 01-08-04, 13:02
somebodyfree somebodyfree is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
If you do not want to use variables. Then you can use something like this.



dim sql
sql = "Insert into tb_user([Username],[Password]) values('"
sql = sql & request.form("username") & "','"
sql = sql & request.form("password") &"')"


Veryfy the sql code using this
response.write sql
Reply With Quote
  #5 (permalink)  
Old 01-08-04, 16:18
luisymary luisymary is offline
Registered User
 
Join Date: Jan 2004
Posts: 10
Cool Insert Record Fixed

Hi,
I just checked your problem and fix it. I include a readme file indicaing some details for next time this happen and the changes I made.
Attached Files
File Type: zip new folder.zip (25.9 KB, 16 views)
Reply With Quote
  #6 (permalink)  
Old 01-08-04, 20:42
SandyLeang SandyLeang is offline
Registered User
 
Join Date: Jan 2004
Location: Phnom Penh
Posts: 9
Thanks to everyone for your help.

The problem has been fixed now, and it is because of i used the restriced keyword in the field name. Anyway, how do i know which is the restricted keyword?

Cheers!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On