Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Lyrad Bangoy
  Where is Lyrad Bangoy?
 Koronadal City
 Philippines
 Lyrad Bangoy
 To: joe Degorio
  Where is joe Degorio?
 Tacloban City
 Philippines
 joe Degorio
 Tags
Subject: RE: Delete table from Mysql
Thread ID: 345385 Message ID: 345401 # Views: 46 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 7:24:48 AM         
   


> Hello everyone!
> I need to delete a particular table from Mysql database...but my code is not good.
>
>
> LOCAL d1
> IF h>0
>     d1="XROOM"
>     TEXT TO lcSQLScript TEXTMERGE NOSHOW PRETEXT 7
>        DROP TABLE <<m.d1>> 
>     ENDTEXT  
> Endif
>    x=SQLEXEC(h,lcSQLScript)
>    IF x>0
>    WAIT WINDOW "Room name deleted..." nowait
>    ELSE
>    MESSAGEBOX("Room name not deleted",64,"Admin")
>    Endif
> 

>
> What am I missing in my code?
>
> Thanks,
> joe

I suspect it is a permission problem, the user you used is not allowed to drop table.
Try below code to check the MySQL error message.

LOCAL d1
DIMENSION aErrMSG[1] && Added for Error handling for ODBC
IF h>0
	d1="XROOM"
	TEXT TO lcSQLScript TEXTMERGE NOSHOW PRETEXT 7
       DROP TABLE <<m.d1>>
	ENDTEXT
ENDIF
x=SQLEXEC(h,lcSQLScript)
IF x>0
	WAIT WINDOW "Room name deleted..." NOWAIT
ELSE
	*MESSAGEBOX("Room name not deleted",64,"Admin")
	nErr = AERROR([aErrMSG]) && Get Error from ODBC
	MESSAGEBOX(aErrMSG[3],16,[MySQL ERROR]) && Display the Error message.
ENDIF


"What makes a man obsolete is when he stop learning."

ENTIRE THREAD

Delete table from Mysql Posted by joe Degorio @ 5/23/2012 5:16:07 AM
RE: Delete table from Mysql Posted by David Kurniawan @ 5/23/2012 5:38:45 AM
RE: Delete table from Mysql Posted by joe Degorio @ 5/23/2012 7:48:21 AM
RE: Delete table from Mysql Posted by Lyrad Bangoy @ 5/23/2012 7:24:48 AM
RE: Delete table from Mysql Posted by joe Degorio @ 5/23/2012 7:48:02 AM
RE: Delete table from Mysql Posted by Lyrad Bangoy @ 5/23/2012 8:29:17 AM
RE: Delete table from Mysql Posted by joe Degorio @ 5/23/2012 8:52:43 AM
RE: Delete table from Mysql Posted by Lyrad Bangoy @ 5/23/2012 10:13:26 AM
RE: Delete table from Mysql Posted by Stefan Wuebbe @ 5/23/2012 7:35:24 AM
RE: Delete table from Mysql Posted by joe Degorio @ 5/23/2012 7:58:24 AM
RE: Delete table from Mysql Posted by Kazi Hasan Mahamud @ 5/23/2012 9:23:42 AM