helllo,
I do have a problem with access...

this is my code:
<%

var connection= new ActiveXObject("ADODB.Connection");
connection.Provider="Microsoft.Jet.OLEDB.4.0";
connection.ConnectionString = "Data Source=" +Server.MapPath("/database/Training11.mdb");
connection.Open;

var SQL = "INSERT INTO User (FirstName, MiddleName, LastName) VALUES ('lolo', 'keymo', 'rub')";

connection.Execute(SQL);
connection.Close();

%>

And i do get this error message:

Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

/testy.asp, line 16

so how could i solve this problem??
do i have some problem in the insert query??
help!!

I changed the (var SQL =) to (SQL = )

Try this:

SQL = "INSERT INTO User (FirstName, MiddleName, LastName) VALUES ('lolo', 'keymo', 'rub')";

connection.Execute(SQL);

ok, but also it doesn't work

i am mad :(

Aha.... let's give it a new shot!

If this doesn't work, try to move the database to same folder as the application and change the path as well to: ("Training11.mdb")


Try this

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/database/Training11.mdb")

SQL = "INSERT INTO User (FirstName, MiddleName, LastName) VALUES ('lolo', 'keymo', 'rub')"
Conn.Execute(SQL)

'Conn.Close
%>

Also it is not working :S

Gaaah !

try to limit the inserts to one at time and see if there is any problem.

I guess you have the correct names for the database table and field and so on ..?


Just like this

SQL = "INSERT INTO User (FirstName) VALUES ('lolo')"

actually i did that also:
<%@ language="vbscript" %>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/database/training.mdb")

SQL = "INSERT INTO User (FirstName) VALUES ('lolo');"
Conn.Execute(SQL)

Conn.Close
%>

and i am sure of all the names :S

Well, there is a remote possibility there is a permission problem. I you haven't checked that then you should do that.

The database can be write protected, and the folders as well.

i discover the problem, it was from the name of my table :S
"User" i am not allowed to name a table with this name

Aha, there you go. Did a similar mistake once and named a field to password. Didn't work very well.

fine :D thanks a lot for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.