Re: Problem updating Recordset



Hi Mark

Thanks for the info. I learnt quite alot.

I see they state that if I change it to:

rs.open "SELECT * FROM tblCustomers WHERE tblCustomersID = " &
cint(request.querystring("item"))

then I should be safe.

But I will definitly keep it in mind.

Thanks.

Camper Joe.




"Mark J. McGinty" wrote:

> While you're googling, search for "SQL Injection", to learn why code like
> this:
>
> >> > rs.open "SELECT * FROM tblCustomers WHERE tblCustomersID = " &
> >> > request.querystring("item")
>
> is a very bad plan.
>
>
> -Mark
>
>
>
>
> "Camper Joe" <CamperJoe@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:EAABCE5F-9942-40B7-8B2A-62F5C5FF1FC7@xxxxxxxxxxxxxxxx
> > Hi Daniel
> >
> > Currently it is the primary key. But I will check out the other solutions
> > on
> > that page.
> >
> > Thanks for the reply.
> >
> > Camper Joe.
> >
> > "Daniel Crichton" wrote:
> >
> >> Camper wrote on Thu, 17 Nov 2005 01:02:04 -0800:
> >>
> >> > Hi
> >> >
> >> > I've got a problem Updating a recordset. I open it up with:
> >> >
> >> > rs.open "SELECT * FROM tblCustomers WHERE tblCustomersID = " &
> >> > request.querystring("item")
> >> >
> >> > rs("strFirstname") = request.form("strFirstname")
> >> > yada
> >> > yada
> >> > wada
> >> > rs.update
> >> > rs.close
> >> >
> >> > When it has to update, it does the following:
> >> >
> >> > Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
> >> > Query-based update failed because the row to update could not be found.
> >> >
> >> > Anybody got an idea?
> >> >
> >> > Thanks.
> >> >
> >> > Camper Joe.
> >>
> >> Googling for the error message brings up a lot of pages about this, such
> >> as http://www.aspfaq.com/show.asp?id=2009
> >>
> >> You haven't got a primary key on your table. Therefore, there's no
> >> underlying pointer to the original row in the table and the update fails.
> >> I'd suggest making tblCustomerID your primary key as your query uses that
> >> as
> >> the unique identifier.
> >>
> >> Dan
> >>
> >>
> >>
>
>
>
.



Relevant Pages

  • Re: Problem updating Recordset
    ... While you're googling, search for "SQL Injection", to learn why code like ... >>> yada ... >>> Camper Joe. ... >> You haven't got a primary key on your table. ...
    (microsoft.public.data.ado)
  • Re: Renumber records on insert, delete and allow only step change of 1
    ... you allocate the number programmatically and take it out of ... primary key, the whole primary key, and nothing but the primary key. ... For more information on try googling for something like "row ... number sql query". ...
    (microsoft.public.access.tablesdbdesign)
  • CRecordSet and primary keys
    ... I table a table in MS Access which had a primary key ... (AutoNumber). ... I could loop through the rows and get the last key and add ... one to it but is this safe? ...
    (microsoft.public.vc.mfc)