delete query.

delete query.

am 05.04.2005 13:31:00 von Nudge

hi,

it's probably a really stupid mistake, but can someone check out this delete
query please?

i am attempting to do a standard delete operation triggerred by a checkbox
("B_Delete")

it deletes all fields, except for ID number (autonumber) in the DB - yet
when i make a direct query in access, it works fine.

thanks in advance

nudge


B_Nr = Request("B_Nr")
B_Branche = Request("Update")
B_New = Request("New")
B_Delete = Request("B_Löschen")

Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("database/main.mdb")
conn.Open connstr

If B_Delete = True Then
strSQL = "Delete * From Branchen" _
& " Where B_Nr=" & B_Nr
End If

Rs2=conn.execute(strSQL)

Re: delete query.

am 05.04.2005 14:17:18 von reb01501

Nudge wrote:
> hi,
>
> it's probably a really stupid mistake, but can someone check out this
> delete query please?
>
> i am attempting to do a standard delete operation triggerred by a
> checkbox ("B_Delete")
>
> it deletes all fields, except for ID number (autonumber) in the DB -
> yet when i make a direct query in access, it works fine.

That's impossible. A Delete query deletes an entire row (forget about the
"Delete *" - that is deceptive).
Why do you think it's not deleting the row? Don't forget, a delete operation
does not "reset" the autonumber to eliminate gaps.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: delete query.

am 05.04.2005 14:33:21 von rdanjou

Are you sure this query is even being executed?
Add these lines before the execute command and check.

response.write strSQL
response.end
> Rs2=conn.execute(strSQL)


"Nudge" wrote in message
news:uYZzpLdOFHA.2144@TK2MSFTNGP09.phx.gbl...
> hi,
>
> it's probably a really stupid mistake, but can someone check out this
> delete
> query please?
>
> i am attempting to do a standard delete operation triggerred by a checkbox
> ("B_Delete")
>
> it deletes all fields, except for ID number (autonumber) in the DB - yet
> when i make a direct query in access, it works fine.
>
> thanks in advance
>
> nudge
>
>
> B_Nr = Request("B_Nr")
> B_Branche = Request("Update")
> B_New = Request("New")
> B_Delete = Request("B_Löschen")
>
> Set conn = Server.CreateObject("ADODB.Connection")
> connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.MapPath("database/main.mdb")
> conn.Open connstr
>
> If B_Delete = True Then
> strSQL = "Delete * From Branchen" _
> & " Where B_Nr=" & B_Nr
> End If
>
> Rs2=conn.execute(strSQL)
>
>
>
>

Re: delete query.

am 05.04.2005 14:38:11 von Nudge

hi bob thanks for your reposnse.

yeah i know - it's got me too. i even included every field name instead of
the * but it didn't change anything.

re the autonumber yeah that's well understood. as i said, if i run the same
query in access itself it's fine.

if you want to have a look, send me an email to "office (AT)
aloevera-versand (DOT) at" and i will send you the log in codes.

thanks

nudge

Re: delete query.

am 05.04.2005 14:53:00 von reb01501

Nudge wrote:
> hi bob thanks for your reposnse.
>
> yeah i know - it's got me too. i even included every field name
> instead of the * but it didn't change anything.

Don't bother. The field list is ignored. I repeat: why do you think the row
is not being deleted?

See the other post as well. Make sure you are constructing a valid sql
statement. Better yet, stop using dynamic sql:
http://groups-beta.google.com/group/microsoft.public.vi.gene ral/msg/0c76ae56f800dd59

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: delete query.

am 05.04.2005 14:54:06 von Nudge

hi raymond - thanks for helping.
yeah done that.

"Delete * From Branchen Where B_Nr=255"

autonumber 255 is now a blank row except for the B_Nr (autonumber)
remaining.

wierd.

Re: delete query.

am 05.04.2005 15:01:21 von Nudge

i knew it had to be a stupid mistake !

as there are multiple queries (delete, insert, update), depending upon which
option had been selected there was a conflict in only one case, hence i was
updating the row and not deleting it.

thanks to you both for helping.

nudge.

Re: delete query.

am 05.04.2005 15:29:47 von rdanjou

The "Stupid" mistakes are always the hardest to find.
Been there, done that.

Glad you figured it out.

"Nudge" wrote in message
news:eEweJ%23dOFHA.244@TK2MSFTNGP12.phx.gbl...
>i knew it had to be a stupid mistake !
>
> as there are multiple queries (delete, insert, update), depending upon
> which
> option had been selected there was a conflict in only one case, hence i
> was
> updating the row and not deleting it.
>
> thanks to you both for helping.
>
> nudge.
>
>