vfp9.0 和mysql 开发的c/s 不用ODBC如何连接数据库?
请教老师:vfp连接mysql除了用ODBC连接,还有哪些方法。因为我觉得多个客户机上安装ODBC驱动是件麻烦事,有的电脑上装了多次都安装不成功。如果大家有什么好的方法从VFP连接mysql请指导一下。不胜感谢!![此贴子已经被作者于2019-9-7 16:56编辑过]
*/Get Server Time Procedure GetServerTime Local ldtRes Local oca As CursorAdapter Local ocon As adodb.Connection Try ocon=Createobject('adodb.connection') ocon.ConnectionString="driver=MySQL ODBC 5.1 Driver;server=192.168.8.250;uid=xxb;pwd=xxb123.*;database=TD_OA;port=3336" ocon.Open() oca = Createobject("CursorAdapter") oca.DataSourceType = "ADO" oca.Datasource = Createobject("ADODB.RecordSet") oca.Datasource.activeconnection =ocon oca.Alias = "_ServerDT" oca.SelectCmd = 'select now() as curTime' oca.CursorFill(.F.,.F.,-1) oca.CursorDetach() ldtRes=_ServerDT.Curtime ocon.Close SELECT _serverDt use Catch */出错 ldtRes=Datetime() Endtry Return ldtRes Endproc