Jump to content

error: insert into


Fry

Recommended Posts

i fellowed the tutorial from ADO tutiral. in one chapter it teaches how to insert value to the table. i use the following code, but i got error: 3708, can anyone help?i have give permission to the account so that it is allowed to modify the mdb file. set conn = Server.CreateObject("ADODB.Connection")conn.Provider = "Microsoft.Jet.OLEDB.4.0"conn.Open "C:\Inetpub\wwwroot\test\test.mdb"sql = "INSERT INTO userAccount (user, password) value (" sql = sql & "'" & Request.Form("user")& "'"sql = sql & ", '" & request.Form("password") & "')"'on error resume nextconn.Exceute sql, recaffectedif err<>0 then response.Write("no update permissions!") response.Write(err)else response.Write(recaffected & " recorded added")end ifconn.close

Link to comment
Share on other sites

Try Thistempuser=Request.Form("user")temppass=Request.Form("password")sql="INSERT INTO userAccount (user, password) values ('"&tempuser&"', '"&temppass&"')"This will definitely help you!

Link to comment
Share on other sites

Hi Fry,Just to make sure that we have the correct SQL statement, print the statement once and check...sql = "INSERT INTO userAccount (user, password) value (" sql = sql & "'" & Request.Form("user")& "'"sql = sql & ", '" & request.Form("password") & "')"response.write(sql)With this you can make sure that you have a correct statement....

Link to comment
Share on other sites

tried all the suggestion from above. the query was fine. there must be something else that prevent me from added data to database.Note: i could read the database. but i can't write, and i have configure the file so then it is allowed to write by internet user.

Link to comment
Share on other sites

tried all the suggestion from above. the query was fine. there must be something else that prevent me from added data to database.Note: i could read the database. but i can't write, and i have configure the file so then it is allowed to write by internet user.

Right click on the folder where the database file is residing, then click Security tab, and give permission for Internet Guest Account - you may give (modify, read, write) or Full Control which includes all these....as you wish, and I think that should help this issue.
Link to comment
Share on other sites

Right click on the folder where the database file is residing, then click Security tab, and give permission for Internet Guest Account - you may give (modify, read, write) or Full Control which includes all these....as you wish, and I think that should help this issue.

tried that, the internet user has full control over the file, but still doens't work.do u use ms acess as database or mySQL or SQL server or Oracle?
Link to comment
Share on other sites

tried that, the internet user has full control over the file, but still doens't work.do u use ms acess as database or mySQL or SQL server or Oracle?

MS Access....It worked for me then what OS are you using? based on that, do a search in google. What is the error msg u r getting? Can you post the error msg?
Link to comment
Share on other sites

MS Access....It worked for me then what OS are you using? based on that, do a search in google. What is the error msg u r getting? Can you post the error msg?

i am using win xp, ms access 2003, this is the error: **Error Type: ADODB.Connection (0x800A0E7C) Parameter object is improperly defined. Inconsistent or incomplete information was provided /test/sqlAddRow.asp, line 12**any clue?
Link to comment
Share on other sites

are you using exactly the code you posted in the post#1, if thats true then there's a spelling mistake. just check this, i guess that would throw different error..you have written ["Exceute" for "Execute"]conn.Exceute sql, recaffected

Link to comment
Share on other sites

Where is your recordset object? shouldn't you have like this:

set conn = Server.CreateObject("ADODB.Connection")conn.Provider = "Microsoft.Jet.OLEDB.4.0"conn.Open "C:\Inetpub\wwwroot\test\test.mdb"sql = "INSERT INTO userAccount (user, password) value (" sql = sql & "'" & Request.Form("user")& "'"sql = sql & ", '" & request.Form("password") & "')"Set rs = Server.CreateObject("ADODB.Recordset")rs.open sql, conn,3,3

Link to comment
Share on other sites

thanks everyone for all the great help. especially thanks to pulpfiction for detecting my spelling mistake on "conn.Exceute sql"i have solved the problem spelling was one of the mistake, but i also used 2 reseved words in my querry and in my table, thats why it didn't work. i changed the table name column name, now the insert query works

Link to comment
Share on other sites

If you dont get through still, then try the below code:
conn.Provider="Microsoft.Jet.OLEDB.4.0; Data" & _       "Source=c:\Inetpub\wwwroot\test\test.mdb"

thanks, the problem was resolved, it was the spelling and reserved words problem.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...