need help to solve Jet database error

R

riyaz

hi all,

i am just triying to post data to MS -access table from normal textarea in
asp page,

here is my code:

<%
Dim cn1,rs1,sql1
Dim sResult,sResult1,sResult2


Set cn1 = Server.CreateObject("ADODB.Connection")
Set rs1 = Server.CreateObject("ADODB.Recordset")


cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"

sResult=Request.Form("s1") //-- data from textarea1
sResult1=Request.Form("s2")//-- data from textarea2
sResult2=Request.Form("s3")//--data from textarea3

if Request.Form("Submit1")= "Submit" then
if c <> 1 then
sql1 = "insert into feb
Values('"&sResult&"','"&sResult1&"','"&sResult2&"')"
rs1.Open sql1,cn1,3,3//--line 82
else
end if
end if
%>
<%
if Request.Form("Submit1") = "Submit" then
if c <> 1 then
Response.Redirect "posted.htm"
end if
else
end if
%>


error is:

Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/webap/insert.asp, line 82

plz help me to modify my code


best regards
Niyaz
 
S

Stefan B Rusynko

Bad syntax for insert (missing filed names (for the 3 files inserted) for the table named feb)
- and ASP comments should be ' delimited not // delimited
See http://www.w3schools.com/ado/ado_add.asp

Would be

Dim cn1,sql1
Dim sResult,sResult1,sResult2
Set cn1 = Server.CreateObject("ADODB.Connection")
cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
sResult=Request.Form("s1") ' data from textarea1
sResult1=Request.Form("s2") ' data from textarea2
sResult2=Request.Form("s3") 'data from textarea3
if Request.Form("Submit1")= "Submit" then
if c <> 1 then 'c must be defined somewhere!
sql1 = "insert into feb (fieldname1,fieldname2,fieldname3)"
sql1 = sql1 & " Values('" & sResult & "','" & sResult1 & "','" & sResult2 &"')"
cn1.Execute sql1
Response.Redirect "posted.htm"
else
' display some error message or other action if c=1
end if
else
' display some other error message or other action if not a form submit
end if
%>



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| hi all,
|
| i am just triying to post data to MS -access table from normal textarea in
| asp page,
|
| here is my code:
|
| <%
| Dim cn1,rs1,sql1
| Dim sResult,sResult1,sResult2
|
|
| Set cn1 = Server.CreateObject("ADODB.Connection")
| Set rs1 = Server.CreateObject("ADODB.Recordset")
|
|
| cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
|
| sResult=Request.Form("s1") //-- data from textarea1
| sResult1=Request.Form("s2")//-- data from textarea2
| sResult2=Request.Form("s3")//--data from textarea3
|
| if Request.Form("Submit1")= "Submit" then
| if c <> 1 then
| sql1 = "insert into feb
| Values('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| rs1.Open sql1,cn1,3,3//--line 82
| else
| end if
| end if
| %>
| <%
| if Request.Form("Submit1") = "Submit" then
| if c <> 1 then
| Response.Redirect "posted.htm"
| end if
| else
| end if
| %>
|
|
| error is:
|
| Microsoft JET Database Engine (0x80004005)
| Operation must use an updateable query.
| /webap/insert.asp, line 82
|
| plz help me to modify my code
|
|
| best regards
| Niyaz
|
 
R

riyaz

i am getting the same error even after modifying the code:


code:

<%

Dim cn1,rs1,sql1
Dim sResult,sResult1,sResult2

Set cn1 = Server.CreateObject("ADODB.Connection")
cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"

sResult=Request.Form("s1")
sResult1=Request.Form("s2")
sResult2=Request.Form("s3")

Set rs1 = Server.CreateObject("ADODB.Recordset")

if Request.Form("Submit1")= "Submit" then

if c <> 1 then

sql1 = "insert into feb (Announcement,Event,Discussion) Values
('"&sResult&"','"&sResult1&"','"&sResult2&"')"
cn1.Execute sql1 ' line 81

Response.Redirect "posted.htm"
else
' error in insert
end if
end if

%>


error is :

Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
/webap/insert.asp, line 81


please help me to do this

thanks & regards
Niyaz

Stefan B Rusynko said:
Bad syntax for insert (missing filed names (for the 3 files inserted) for the table named feb)
- and ASP comments should be ' delimited not // delimited
See http://www.w3schools.com/ado/ado_add.asp

Would be

Dim cn1,sql1
Dim sResult,sResult1,sResult2
Set cn1 = Server.CreateObject("ADODB.Connection")
cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
sResult=Request.Form("s1") ' data from textarea1
sResult1=Request.Form("s2") ' data from textarea2
sResult2=Request.Form("s3") 'data from textarea3
if Request.Form("Submit1")= "Submit" then
if c <> 1 then 'c must be defined somewhere!
sql1 = "insert into feb (fieldname1,fieldname2,fieldname3)"
sql1 = sql1 & " Values('" & sResult & "','" & sResult1 & "','" & sResult2 &"')"
cn1.Execute sql1
Response.Redirect "posted.htm"
else
' display some error message or other action if c=1
end if
else
' display some other error message or other action if not a form submit
end if
%>



--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| hi all,
|
| i am just triying to post data to MS -access table from normal textarea in
| asp page,
|
| here is my code:
|
| <%
| Dim cn1,rs1,sql1
| Dim sResult,sResult1,sResult2
|
|
| Set cn1 = Server.CreateObject("ADODB.Connection")
| Set rs1 = Server.CreateObject("ADODB.Recordset")
|
|
| cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
|
| sResult=Request.Form("s1") //-- data from textarea1
| sResult1=Request.Form("s2")//-- data from textarea2
| sResult2=Request.Form("s3")//--data from textarea3
|
| if Request.Form("Submit1")= "Submit" then
| if c <> 1 then
| sql1 = "insert into feb
| Values('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| rs1.Open sql1,cn1,3,3//--line 82
| else
| end if
| end if
| %>
| <%
| if Request.Form("Submit1") = "Submit" then
| if c <> 1 then
| Response.Redirect "posted.htm"
| end if
| else
| end if
| %>
|
|
| error is:
|
| Microsoft JET Database Engine (0x80004005)
| Operation must use an updateable query.
| /webap/insert.asp, line 82
|
| plz help me to modify my code
|
|
| best regards
| Niyaz
|
 
S

Stefan B Rusynko

The below line must all be on 1 line
(if you are not going to split it per my example)

sql1 = "insert into feb (Announcement,Event,Discussion) Values ('"&sResult&"','"&sResult1&"','"&sResult2&"')"

Also delete the unneeded line
Set rs1 = Server.CreateObject("ADODB.Recordset")

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|i am getting the same error even after modifying the code:
|
|
| code:
|
| <%
|
| Dim cn1,rs1,sql1
| Dim sResult,sResult1,sResult2
|
| Set cn1 = Server.CreateObject("ADODB.Connection")
| cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
|
| sResult=Request.Form("s1")
| sResult1=Request.Form("s2")
| sResult2=Request.Form("s3")
|
| Set rs1 = Server.CreateObject("ADODB.Recordset")
|
| if Request.Form("Submit1")= "Submit" then
|
| if c <> 1 then
|
| sql1 = "insert into feb (Announcement,Event,Discussion) Values
| ('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| cn1.Execute sql1 ' line 81
|
| Response.Redirect "posted.htm"
| else
| ' error in insert
| end if
| end if
|
| %>
|
|
| error is :
|
| Microsoft JET Database Engine (0x80004005)
| Operation must use an updateable query.
| /webap/insert.asp, line 81
|
|
| please help me to do this
|
| thanks & regards
| Niyaz
|
| "Stefan B Rusynko" wrote:
|
| > Bad syntax for insert (missing filed names (for the 3 files inserted) for the table named feb)
| > - and ASP comments should be ' delimited not // delimited
| > See http://www.w3schools.com/ado/ado_add.asp
| >
| > Would be
| >
| > Dim cn1,sql1
| > Dim sResult,sResult1,sResult2
| > Set cn1 = Server.CreateObject("ADODB.Connection")
| > cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| > cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
| > sResult=Request.Form("s1") ' data from textarea1
| > sResult1=Request.Form("s2") ' data from textarea2
| > sResult2=Request.Form("s3") 'data from textarea3
| > if Request.Form("Submit1")= "Submit" then
| > if c <> 1 then 'c must be defined somewhere!
| > sql1 = "insert into feb (fieldname1,fieldname2,fieldname3)"
| > sql1 = sql1 & " Values('" & sResult & "','" & sResult1 & "','" & sResult2 &"')"
| > cn1.Execute sql1
| > Response.Redirect "posted.htm"
| > else
| > ' display some error message or other action if c=1
| > end if
| > else
| > ' display some other error message or other action if not a form submit
| > end if
| > %>
| >
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > _____________________________________________
| >
| >
| > | hi all,
| > |
| > | i am just triying to post data to MS -access table from normal textarea in
| > | asp page,
| > |
| > | here is my code:
| > |
| > | <%
| > | Dim cn1,rs1,sql1
| > | Dim sResult,sResult1,sResult2
| > |
| > |
| > | Set cn1 = Server.CreateObject("ADODB.Connection")
| > | Set rs1 = Server.CreateObject("ADODB.Recordset")
| > |
| > |
| > | cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| > | cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
| > |
| > | sResult=Request.Form("s1") //-- data from textarea1
| > | sResult1=Request.Form("s2")//-- data from textarea2
| > | sResult2=Request.Form("s3")//--data from textarea3
| > |
| > | if Request.Form("Submit1")= "Submit" then
| > | if c <> 1 then
| > | sql1 = "insert into feb
| > | Values('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| > | rs1.Open sql1,cn1,3,3//--line 82
| > | else
| > | end if
| > | end if
| > | %>
| > | <%
| > | if Request.Form("Submit1") = "Submit" then
| > | if c <> 1 then
| > | Response.Redirect "posted.htm"
| > | end if
| > | else
| > | end if
| > | %>
| > |
| > |
| > | error is:
| > |
| > | Microsoft JET Database Engine (0x80004005)
| > | Operation must use an updateable query.
| > | /webap/insert.asp, line 82
| > |
| > | plz help me to modify my code
| > |
| > |
| > | best regards
| > | Niyaz
| > |
| >
| >
| >
 
R

riyaz

i have already do in the same way as u suggest me, i put the query in a
single line.
but still i am getting the same error on the same line,
any problem with iis ? or the ms-access database.

Best regards
Niyaz

Stefan B Rusynko said:
The below line must all be on 1 line
(if you are not going to split it per my example)

sql1 = "insert into feb (Announcement,Event,Discussion) Values ('"&sResult&"','"&sResult1&"','"&sResult2&"')"

Also delete the unneeded line
Set rs1 = Server.CreateObject("ADODB.Recordset")

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|i am getting the same error even after modifying the code:
|
|
| code:
|
| <%
|
| Dim cn1,rs1,sql1
| Dim sResult,sResult1,sResult2
|
| Set cn1 = Server.CreateObject("ADODB.Connection")
| cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
|
| sResult=Request.Form("s1")
| sResult1=Request.Form("s2")
| sResult2=Request.Form("s3")
|
| Set rs1 = Server.CreateObject("ADODB.Recordset")
|
| if Request.Form("Submit1")= "Submit" then
|
| if c <> 1 then
|
| sql1 = "insert into feb (Announcement,Event,Discussion) Values
| ('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| cn1.Execute sql1 ' line 81
|
| Response.Redirect "posted.htm"
| else
| ' error in insert
| end if
| end if
|
| %>
|
|
| error is :
|
| Microsoft JET Database Engine (0x80004005)
| Operation must use an updateable query.
| /webap/insert.asp, line 81
|
|
| please help me to do this
|
| thanks & regards
| Niyaz
|
| "Stefan B Rusynko" wrote:
|
| > Bad syntax for insert (missing filed names (for the 3 files inserted) for the table named feb)
| > - and ASP comments should be ' delimited not // delimited
| > See http://www.w3schools.com/ado/ado_add.asp
| >
| > Would be
| >
| > Dim cn1,sql1
| > Dim sResult,sResult1,sResult2
| > Set cn1 = Server.CreateObject("ADODB.Connection")
| > cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| > cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
| > sResult=Request.Form("s1") ' data from textarea1
| > sResult1=Request.Form("s2") ' data from textarea2
| > sResult2=Request.Form("s3") 'data from textarea3
| > if Request.Form("Submit1")= "Submit" then
| > if c <> 1 then 'c must be defined somewhere!
| > sql1 = "insert into feb (fieldname1,fieldname2,fieldname3)"
| > sql1 = sql1 & " Values('" & sResult & "','" & sResult1 & "','" & sResult2 &"')"
| > cn1.Execute sql1
| > Response.Redirect "posted.htm"
| > else
| > ' display some error message or other action if c=1
| > end if
| > else
| > ' display some other error message or other action if not a form submit
| > end if
| > %>
| >
| >
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| > http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > _____________________________________________
| >
| >
| > | hi all,
| > |
| > | i am just triying to post data to MS -access table from normal textarea in
| > | asp page,
| > |
| > | here is my code:
| > |
| > | <%
| > | Dim cn1,rs1,sql1
| > | Dim sResult,sResult1,sResult2
| > |
| > |
| > | Set cn1 = Server.CreateObject("ADODB.Connection")
| > | Set rs1 = Server.CreateObject("ADODB.Recordset")
| > |
| > |
| > | cn1.Provider = "MicroSoft.jet.OLEDB.4.0"
| > | cn1.Open "C:\Inetpub\wwwroot\webap\test.mdb"
| > |
| > | sResult=Request.Form("s1") //-- data from textarea1
| > | sResult1=Request.Form("s2")//-- data from textarea2
| > | sResult2=Request.Form("s3")//--data from textarea3
| > |
| > | if Request.Form("Submit1")= "Submit" then
| > | if c <> 1 then
| > | sql1 = "insert into feb
| > | Values('"&sResult&"','"&sResult1&"','"&sResult2&"')"
| > | rs1.Open sql1,cn1,3,3//--line 82
| > | else
| > | end if
| > | end if
| > | %>
| > | <%
| > | if Request.Form("Submit1") = "Submit" then
| > | if c <> 1 then
| > | Response.Redirect "posted.htm"
| > | end if
| > | else
| > | end if
| > | %>
| > |
| > |
| > | error is:
| > |
| > | Microsoft JET Database Engine (0x80004005)
| > | Operation must use an updateable query.
| > | /webap/insert.asp, line 82
| > |
| > | plz help me to modify my code
| > |
| > |
| > | best regards
| > | Niyaz
| > |
| >
| >
| >
 
E

e.pricecut

All code inconsistencies aside, you should check permissions for the
database. You should have "write" permission for anonymous IIS account
on .mdb..
 
R

riyaz

thanks for your suggestion, you are correct.
there is no permission for the iis anonymous IIS account

now i gave permission & its working now.

thanks & regards
Niyaz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top