Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Andy #1
Me again Paul Whitham
This should be easy, even for me, BUT
I'm using the same code for the INSERT new retailer on another page INSERT
new product.
I have changed it slightly to insert the Session UserID instead of the
Session ProductID
Here's the code but i keep ketting this error:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query.
THE CODE:
<%
'Create a connection to your database
dim strConn
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../dbase_safe\brochure.mdb")
'Read in the Retailers Table
dim adoCn
dim adoRs
dim strSQL
set adoCn=Server.CreateObject("ADODB.Connection")
adoCn.Open strConn
set adoRs=Server.CreateObject("ADODB.Recordset")
strSQL="Select UserID from retailers"
set adoRs=adoCn.Execute(strSQL)
Do While not adoRs.EOF
sUserID=adoRs ("UserID")
'Carry out insert
strSQL="Insert into Prices(productID,UserID) values ("& session("ProductID")
& "," & sUserID &")"
adoCn.Execute strSQL
adoRS.MoveNext
Loop
adoRs.Close
set adoRs=nothing
adoCn.Close
set adoCn=nothing
%>
Andy Guest
-
99% there - FAQ Paul Whitham
Hi Paul Please see my reply to one of my earlier posts called "FAO Nancy Gill" The page with you code on is now inserting one product after... -
FAO Paul Whitham
Paul please see my last post re: Still struggling on this one. :-( Andy -
Attn. Paul Taylor
Don't you hate it when people go "Attn. A Name" in the subject line. For a brief moment you think "oh oh, what have I done now" :-) Just... -
RobGT #2
Re: Me again Paul Whitham
Make sure you have the correct (at least Modify) permissions set on the
folder in which your access database resides.
HTH
Rob
[url]http://robgt.com/[/url]
Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
Extensions: [url]http://robgt.com/products/index.asp[/url]
RobGT Guest
-
Andy #3
Re: Me again Paul Whitham
Hi RobGT
I'm sure the settings are ok because i have other pages updating the same
database.
Thanks for replying.
Andy
"RobGT" <rob@lighthouseuk.removeme.net> wrote in message
news:d5d4hf$98g$1@forums.macromedia.com...> Make sure you have the correct (at least Modify) permissions set on the
> folder in which your access database resides.
>
> HTH
> Rob
> [url]http://robgt.com/[/url]
> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
> Extensions: [url]http://robgt.com/products/index.asp[/url]
>
>
Andy Guest
-
RobGT #4
Re: Me again Paul Whitham
It's possible then, if your other pages are working fine, that you are
trying to perform an update on a database object that doesn't allow updates?
What is the object you are trying to update?
A table? Query?
Cheers,
Rob
[url]http://robgt.com/[/url]
Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
Extensions: [url]http://robgt.com/products/index.asp[/url]
RobGT Guest
-
Andy #5
Re: Me again Paul Whitham
Hi RobGT
On one page i have this code which works fine: It inserts all of the
productID's into the new RetailerID
<%
'Create a connection to your database
dim strConn
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../dbase_safe\brochure.mdb")
'Read in the Products Table
dim adoCn
dim adoRs
dim strSQL
set adoCn=Server.CreateObject("ADODB.Connection")
adoCn.Open strConn
set adoRs=Server.CreateObject("ADODB.Recordset")
strSQL="Select ProductID from Products"
set adoRs=adoCn.Execute(strSQL)
Do While not adoRs.EOF
sProductID=adoRs("productID")
'Carry out insert
strSQL="Insert into Prices(UserID,productID) values ("& session("UserID") &
"," & sProductID &")"
adoCn.Execute strSQL
adoRS.MoveNext
Loop
adoRs.Close
set adoRs=nothing
adoCn.Close
set adoCn=nothing
%>
I changed the code slightly so that when a new ProductID is inserted, it
populates all of the retailers with the new productID: This is the code:
<%
'Create a connection to your database
dim strConn
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../dbase_safe\brochure.mdb")
'Read in the Retailers Table
dim adoCn
dim adoRs
dim strSQL
set adoCn=Server.CreateObject("ADODB.Connection")
adoCn.Open strConn
set adoRs=Server.CreateObject("ADODB.Recordset")
strSQL="Select UserID from retailers"
set adoRs=adoCn.Execute(strSQL)
Do While not adoRs.EOF
sUserID=adoRs ("UserID")
'Carry out insert
strSQL="Insert into Prices(productID,UserID) values ("& session("ProductID")
& "," & sUserID &")"
adoCn.Execute strSQL
adoRS.MoveNext
Loop
adoRs.Close
set adoRs=nothing
adoCn.Close
set adoCn=nothing
%>
Thanks
Andy
"RobGT" <rob@lighthouseuk.removeme.net> wrote in message
news:d5dcdl$l4u$1@forums.macromedia.com...> It's possible then, if your other pages are working fine, that you are
> trying to perform an update on a database object that doesn't allow
> updates?
>
> What is the object you are trying to update?
> A table? Query?
> Cheers,
> Rob
> [url]http://robgt.com/[/url]
> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
> Extensions: [url]http://robgt.com/products/index.asp[/url]
>
>
Andy Guest
-
RobGT #6
Re: Me again Paul Whitham
Looking through your code, I can't really see anything wrong with it
comparing the two code samples you posted.
The one thing that first struck me was this line:
adoRs ("UserID")
Contains a space, it shouldn't.
Now, that might be down to newsgroup formatting, or it might be your code??
Double check that to be sure.
Let me know if not and I'll try looking a little closer (it does seem ok to
me though?)
Cheers,
Rob
[url]http://robgt.com/[/url]
Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
Extensions: [url]http://robgt.com/products/index.asp[/url]
RobGT Guest
-
Lionstone #7
Re: Me again Paul Whitham
UserID is an Access reserved word and cannot be used as a field name.
Change your query so that UserID is surrounded by brackets. "INSERT INTO
Prices(ProductID, [UserID]) ..."
"Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
news:d5cpnt$nsb$1@forums.macromedia.com...> This should be easy, even for me, BUT
> I'm using the same code for the INSERT new retailer on another page INSERT
> new product.
> I have changed it slightly to insert the Session UserID instead of the
> Session ProductID
> Here's the code but i keep ketting this error:
>
> Microsoft JET Database Engine (0x80004005)
> Operation must use an updateable query.
>
> THE CODE:
> <%
> 'Create a connection to your database
> dim strConn
> strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.MapPath("../dbase_safe\brochure.mdb")
> 'Read in the Retailers Table
> dim adoCn
> dim adoRs
> dim strSQL
> set adoCn=Server.CreateObject("ADODB.Connection")
> adoCn.Open strConn
> set adoRs=Server.CreateObject("ADODB.Recordset")
> strSQL="Select UserID from retailers"
> set adoRs=adoCn.Execute(strSQL)
>
>
> Do While not adoRs.EOF
> sUserID=adoRs ("UserID")
>
>
> 'Carry out insert
> strSQL="Insert into Prices(productID,UserID) values ("&
> session("ProductID") & "," & sUserID &")"
> adoCn.Execute strSQL
> adoRS.MoveNext
> Loop
>
> adoRs.Close
> set adoRs=nothing
> adoCn.Close
> set adoCn=nothing
> %>
>
>
>
Lionstone Guest
-
RobGT #8
Re: Me again Paul Whitham
Ah-ha
Access reserved words!
Doh!
Rob
[url]http://robgt.com/[/url]
Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
Extensions: [url]http://robgt.com/products/index.asp[/url]
RobGT Guest
-
Andy #9
Re: Me again Paul Whitham
Hi Guys
Sorry i haven't replied earlier, i've been a bit busy.
Thanks for the tips, i'll give it a go later and report back.
Thanks again
Andy
"RobGT" <rob@lighthouseuk.removeme.net> wrote in message
news:d5o1g0$247$1@forums.macromedia.com...> Ah-ha
> Access reserved words!
> Doh!
>
> Rob
> [url]http://robgt.com/[/url]
> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
> Extensions: [url]http://robgt.com/products/index.asp[/url]
>
>
Andy Guest
-
Andy #10
Re: Me again Paul Whitham
:-(
Still no joy - i changed the code to:
<%
'Create a connection to your database
dim strConn
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../dbase_safe\brochure.mdb")
'Read in the Products Table
dim adoCn
dim adoRs
dim strSQL
set adoCn=Server.CreateObject("ADODB.Connection")
adoCn.Open strConn
set adoRs=Server.CreateObject("ADODB.Recordset")
strSQL="Select ProductID from Products"
set adoRs=adoCn.Execute(strSQL)
Do While not adoRs.EOF
sProductID=adoRs("productID")
'Carry out insert
strSQL="Insert into Prices([UserID],productID) values ("& session("UserID")
& "," & sProductID &")"
adoCn.Execute strSQL
adoRS.MoveNext
Loop
adoRs.Close
set adoRs=nothing
adoCn.Close
set adoCn=nothing
%>
"Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
news:d5q8ia$aod$1@forums.macromedia.com...> Hi Guys
> Sorry i haven't replied earlier, i've been a bit busy.
>
> Thanks for the tips, i'll give it a go later and report back.
>
> Thanks again
>
> Andy
>
>
> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
> news:d5o1g0$247$1@forums.macromedia.com...>>> Ah-ha
>> Access reserved words!
>> Doh!
>>
>> Rob
>> [url]http://robgt.com/[/url]
>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
>> Extensions: [url]http://robgt.com/products/index.asp[/url]
>>
>>
>
>
>
Andy Guest
-
Andy #11
Re: Me again Paul Whitham
I know that you said that UserID is a reserved word but i'm using it to
insert the new retailer. See code below, which works.
<%
'Create a connection to your database
dim strConn
strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../dbase_safe\brochure.mdb")
'Read in the Products Table
dim adoCn
dim adoRs
dim strSQL
set adoCn=Server.CreateObject("ADODB.Connection")
adoCn.Open strConn
set adoRs=Server.CreateObject("ADODB.Recordset")
strSQL="Select ProductID from Products"
set adoRs=adoCn.Execute(strSQL)
Do While not adoRs.EOF
sProductID=adoRs("productID")
'Carry out insert
strSQL="Insert into Prices(UserID,productID) values ("& session("UserID") &
"," & sProductID &")"
adoCn.Execute strSQL
adoRS.MoveNext
Loop
adoRs.Close
set adoRs=nothing
adoCn.Close
set adoCn=nothing
%>
"Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
news:d5qf5s$kum$1@forums.macromedia.com...> :-(
>
> Still no joy - i changed the code to:
>
> <%
> 'Create a connection to your database
> dim strConn
> strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.MapPath("../dbase_safe\brochure.mdb")
> 'Read in the Products Table
> dim adoCn
> dim adoRs
> dim strSQL
> set adoCn=Server.CreateObject("ADODB.Connection")
> adoCn.Open strConn
> set adoRs=Server.CreateObject("ADODB.Recordset")
> strSQL="Select ProductID from Products"
> set adoRs=adoCn.Execute(strSQL)
>
>
> Do While not adoRs.EOF
> sProductID=adoRs("productID")
>
> 'Carry out insert
> strSQL="Insert into Prices([UserID],productID) values ("&
> session("UserID") & "," & sProductID &")"
> adoCn.Execute strSQL
> adoRS.MoveNext
> Loop
>
> adoRs.Close
> set adoRs=nothing
> adoCn.Close
> set adoCn=nothing
> %>
>
> "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
> news:d5q8ia$aod$1@forums.macromedia.com...>>> Hi Guys
>> Sorry i haven't replied earlier, i've been a bit busy.
>>
>> Thanks for the tips, i'll give it a go later and report back.
>>
>> Thanks again
>>
>> Andy
>>
>>
>> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
>> news:d5o1g0$247$1@forums.macromedia.com...>>>>> Ah-ha
>>> Access reserved words!
>>> Doh!
>>>
>>> Rob
>>> [url]http://robgt.com/[/url]
>>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
>>> Extensions: [url]http://robgt.com/products/index.asp[/url]
>>>
>>>
>>
>>
>>
>
>
>
Andy Guest
-
Paul Whitham TMM #12
Re: Me again Paul Whitham
Check that this is not a typo
Server.MapPath("../dbase_safe\brochure.mdb")
as it should be
Server.MapPath("../dbase_safe/brochure.mdb")
--
Regards
Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
[url]www.valleybiz.net[/url]
Team Macromedia Volunteer for Ultradev/Dreamweaver MX
[url]www.macromedia.com/support/forums/team_macromedia[/url]
"Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
news:d5qffb$lch$1@forums.macromedia.com...&> I know that you said that UserID is a reserved word but i'm using it to
> insert the new retailer. See code below, which works.
>
> <%
> 'Create a connection to your database
> dim strConn
> strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.MapPath("../dbase_safe\brochure.mdb")
> 'Read in the Products Table
> dim adoCn
> dim adoRs
> dim strSQL
> set adoCn=Server.CreateObject("ADODB.Connection")
> adoCn.Open strConn
> set adoRs=Server.CreateObject("ADODB.Recordset")
> strSQL="Select ProductID from Products"
> set adoRs=adoCn.Execute(strSQL)
>
>
> Do While not adoRs.EOF
> sProductID=adoRs("productID")
>
> 'Carry out insert
> strSQL="Insert into Prices(UserID,productID) values ("& session("UserID")> "," & sProductID &")"
> adoCn.Execute strSQL
> adoRS.MoveNext
> Loop
>
> adoRs.Close
> set adoRs=nothing
> adoCn.Close
> set adoCn=nothing
> %>
>
>
> "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
> news:d5qf5s$kum$1@forums.macromedia.com...>> > :-(
> >
> > Still no joy - i changed the code to:
> >
> > <%
> > 'Create a connection to your database
> > dim strConn
> > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> > Server.MapPath("../dbase_safe\brochure.mdb")
> > 'Read in the Products Table
> > dim adoCn
> > dim adoRs
> > dim strSQL
> > set adoCn=Server.CreateObject("ADODB.Connection")
> > adoCn.Open strConn
> > set adoRs=Server.CreateObject("ADODB.Recordset")
> > strSQL="Select ProductID from Products"
> > set adoRs=adoCn.Execute(strSQL)
> >
> >
> > Do While not adoRs.EOF
> > sProductID=adoRs("productID")
> >
> > 'Carry out insert
> > strSQL="Insert into Prices([UserID],productID) values ("&
> > session("UserID") & "," & sProductID &")"
> > adoCn.Execute strSQL
> > adoRS.MoveNext
> > Loop
> >
> > adoRs.Close
> > set adoRs=nothing
> > adoCn.Close
> > set adoCn=nothing
> > %>
> >
> > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
> > news:d5q8ia$aod$1@forums.macromedia.com...> >> >> Hi Guys
> >> Sorry i haven't replied earlier, i've been a bit busy.
> >>
> >> Thanks for the tips, i'll give it a go later and report back.
> >>
> >> Thanks again
> >>
> >> Andy
> >>
> >>
> >> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
> >> news:d5o1g0$247$1@forums.macromedia.com...
> >>> Ah-ha
> >>> Access reserved words!
> >>> Doh!
> >>>
> >>> Rob
> >>> [url]http://robgt.com/[/url]
> >>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
> >>> Extensions: [url]http://robgt.com/products/index.asp[/url]
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
Paul Whitham TMM Guest
-
Andy #13
Re: Me again Paul Whitham
Hi paul
Still no joy.
Very strange
Andy
"Paul Whitham TMM" <paul@valleybiz.net> wrote in message
news:d5rvet$pk$1@forums.macromedia.com...> Check that this is not a typo
>
> Server.MapPath("../dbase_safe\brochure.mdb")
>
> as it should be
>
> Server.MapPath("../dbase_safe/brochure.mdb")
>
>
> --
> Regards
>
> Paul Whitham
> Macromedia Certified Professional for Dreamweaver MX2004
> Valleybiz Internet Design
> [url]www.valleybiz.net[/url]
>
> Team Macromedia Volunteer for Ultradev/Dreamweaver MX
> [url]www.macromedia.com/support/forums/team_macromedia[/url]
>
> "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
> news:d5qffb$lch$1@forums.macromedia.com...> &>> I know that you said that UserID is a reserved word but i'm using it to
>> insert the new retailer. See code below, which works.
>>
>> <%
>> 'Create a connection to your database
>> dim strConn
>> strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
>> Server.MapPath("../dbase_safe\brochure.mdb")
>> 'Read in the Products Table
>> dim adoCn
>> dim adoRs
>> dim strSQL
>> set adoCn=Server.CreateObject("ADODB.Connection")
>> adoCn.Open strConn
>> set adoRs=Server.CreateObject("ADODB.Recordset")
>> strSQL="Select ProductID from Products"
>> set adoRs=adoCn.Execute(strSQL)
>>
>>
>> Do While not adoRs.EOF
>> sProductID=adoRs("productID")
>>
>> 'Carry out insert
>> strSQL="Insert into Prices(UserID,productID) values ("& session("UserID")>>> "," & sProductID &")"
>> adoCn.Execute strSQL
>> adoRS.MoveNext
>> Loop
>>
>> adoRs.Close
>> set adoRs=nothing
>> adoCn.Close
>> set adoCn=nothing
>> %>
>>
>>
>> "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
>> news:d5qf5s$kum$1@forums.macromedia.com...>>>> > :-(
>> >
>> > Still no joy - i changed the code to:
>> >
>> > <%
>> > 'Create a connection to your database
>> > dim strConn
>> > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
>> > Server.MapPath("../dbase_safe\brochure.mdb")
>> > 'Read in the Products Table
>> > dim adoCn
>> > dim adoRs
>> > dim strSQL
>> > set adoCn=Server.CreateObject("ADODB.Connection")
>> > adoCn.Open strConn
>> > set adoRs=Server.CreateObject("ADODB.Recordset")
>> > strSQL="Select ProductID from Products"
>> > set adoRs=adoCn.Execute(strSQL)
>> >
>> >
>> > Do While not adoRs.EOF
>> > sProductID=adoRs("productID")
>> >
>> > 'Carry out insert
>> > strSQL="Insert into Prices([UserID],productID) values ("&
>> > session("UserID") & "," & sProductID &")"
>> > adoCn.Execute strSQL
>> > adoRS.MoveNext
>> > Loop
>> >
>> > adoRs.Close
>> > set adoRs=nothing
>> > adoCn.Close
>> > set adoCn=nothing
>> > %>
>> >
>> > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
>> > news:d5q8ia$aod$1@forums.macromedia.com...
>> >> Hi Guys
>> >> Sorry i haven't replied earlier, i've been a bit busy.
>> >>
>> >> Thanks for the tips, i'll give it a go later and report back.
>> >>
>> >> Thanks again
>> >>
>> >> Andy
>> >>
>> >>
>> >> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
>> >> news:d5o1g0$247$1@forums.macromedia.com...
>> >>> Ah-ha
>> >>> Access reserved words!
>> >>> Doh!
>> >>>
>> >>> Rob
>> >>> [url]http://robgt.com/[/url]
>> >>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
>> >>> Extensions: [url]http://robgt.com/products/index.asp[/url]
>> >>>
>> >>>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> >
>>
>>
>
>
Andy Guest



Reply With Quote

