Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: joe Degorio
  Where is joe Degorio?
 Tacloban City
 Philippines
 joe Degorio
 To: David Kurniawan
  Where is David Kurniawan?
 Semarang
 Indonesia
 David Kurniawan
 Tags
Subject: RE: Delete table from Mysql
Thread ID: 345385 Message ID: 345404 # Views: 34 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Wednesday, May 23, 2012 7:48:21 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
>
> Dear JOE
> What declare on lcSQLScript ???????? if h<0
>
>
>
> BR
>
> DAVID KURNIAWAN
> mamamia

Hi David,
The code below is what I use to connect the database

SET date YMD 
PUBLIC h,lcStringConn,lcSQLScript
lcServer="localhost"
lcDatabase="demo_system"
lcUser = "root"
lcPassword = ""
lcStringConn="Driver={MySQL ODBC 3.51 Driver};Port=3306"+;
             ";Server="+lcServer+;
             ";Database="+lcDatabase+;
             ";Uid="+lcUser+;
             ";Pwd="+lcPassWord
*** Don't prompt for login
SQLSETPROP(0,"DispLogin",3)

h = SQLSTRINGCONNECT(lcStringConn)

IF h > 0
  WAIT WINDOW "Database is now Connected!" nowait
  
ELSE
*   =AERROR(laError)
   MESSAGEBOX("Error at Connecting"+chr(13)+"Please contact the Administrator to fix the error...",48," Demo System V.01")
             * "Description:"+laError[2])
			 *	quit
ENDIF
return



...lcSQLScript is declared public...and h is for the handler.

Regards,
Joe

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