[SOLVED] ASP-MySQL Delete By Checkbox

This is a discussion on "[SOLVED] ASP-MySQL Delete By Checkbox" within the Classic ASP section. This forum, and the thread "[SOLVED] ASP-MySQL Delete By Checkbox are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Nov 10th, 2007, 00:57
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,609
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
[SOLVED] ASP-MySQL Delete By Checkbox

Hai,

I manage to do/use this code with Access Database but ended up with this error when I use MySQL Database.

Code: Select all
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
ODBC driver does not support the requested properties.
/my-pm-inbox.asp, line 24
This is my code to delete by checkbox:
Code: Select all
    Dim connectionString, pm, conn, rsCount
    connectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=monieweb; OPTION=4; UID=root; PASSWORD=monie;"
    Set conn = Server.CreateObject("ADODB.Connection")
    Set pm = Server.CreateObject("ADODB.Recordset") 
    conn.Open(connectionString)
   
    Dim comment
    For Each comment In Request("delete")
         pm.Open "DELETE * FROM userpm WHERE pmNo = "& comment &"", conn,3,3
    Next 
        pm.Open "SELECT * FROM userpm WHERE username = '"& user &"' ORDER BY pmNo DESC", conn
Code: Select all
<input type="checkbox" name="delete" title="Select" value="<%=pm("pmNo")%>">
This method of deleting using check box works marvelously if I use Access Database. How to twist this code for MySQL Database? Any idea?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 10th, 2007, 01:51
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,609
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: ASP-MySQL Delete By Checkbox

I solved them myself, what a stupid error!

Code: Select all
    Dim connectionString, pm, conn, rsCount
    connectionString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=monieweb; OPTION=4; UID=root; PASSWORD=monie;"
    Set conn = Server.CreateObject("ADODB.Connection")
    Set pm = Server.CreateObject("ADODB.Recordset") 
    conn.Open(connectionString)

    Dim comment
    For Each comment In Request("delete")
        pm.Open "DELETE FROM userpm WHERE pmNo = "& comment &"", conn,3,3
        'Set pm = conn.Execute ("DELETE FROM userpm WHERE pmNo = "& comment &"") Can be done like this too, I don't have idea what is the different??
     Next 
        pm.Open "SELECT * FROM userpm WHERE username = '" & Session ("name") & "' ORDER BY pmNo DESC", conn
        'Set pm = conn.Execute ("DELETE FROM userpm WHERE pmNo = "& comment &"") Can be done like this too, I don't have idea what is the different??
Error is in this line of SQL Statement:
Code: Select all
pm.Open "DELETE FROM userpm WHERE pmNo = "& comment &"", conn,3,3
throw away the '*' after the DELETE
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Nov 10th, 2007 at 01:56.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] help with checkbox and textfield in form BRONIC JavaScript Forum 8 Apr 22nd, 2008 16:08
delete by checkbox FlashO Classic ASP 3 Mar 30th, 2008 08:42
checkbox[] array into mysql... OUT? ppgpilot PHP Forum 1 Mar 13th, 2008 20:37
[SOLVED] Form to email with checkbox itsdesign PHP Forum 4 Oct 29th, 2007 00:57
A Solved Checkbox snow Webforumz Suggestions and Feedback 14 Sep 25th, 2007 20:11


All times are GMT. The time now is 00:39.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42