Rabu, 09 Desember 2015
Cara Koneksi SQl dengan Foxpro
I will explain how do I connect to the MySQL database Visual FoxPro there are several connections provided by VFP can see in help (F1) 1. SQLCONNECT SQLCONNECT ([cConnectionName | cDataSourceName [, cUserID [, cPassword]] [, lShared]]) example STORE SQLCONNECT ('MyFoxSQLNT', 'myUserID', 'mypassword') TO gnConnHandle IF gnConnHandle <= 0 = MessageBox ("Can not make connection ', 16' SQL Connect Error ') ELSE = MessageBox ('Connection made', 48, 'SQL Connect Message') = SQLDISCONNECT (gnHandle) ENDIF 2.SQLSTRINGCONNECT source = "Driver = MySQL ODBC 5.1 Driver;"; + "SERVER = localhost;"; + "UID = root;"; + "PWD = 12345;"; + "DATABASE = school;"; + "PORT = 3306" pkonek = SQLSTRINGCONNECT (source) if pkonek <0 messagebox ('Connection failed', 16, 'Error') else messagebox ('Connection Successful', 16, 'Success') below are some ways to read FoxPro database with sql server. 1. We must know the location FOLDER say dbf file in D: \ DBF \ 2. We must have Foxfro driver can be downloaded at http://www.microsoft.com/en-us/download/details.aspx?id=14839 3. Then once installed it will automatically read the SQL Server driver to connect to the database FoxPro or .dbf 4.Selanjutnya enter through SQL Query (I use SQL Server 2005) typed script below to create Link Server use master EXEC master.dbo.sp_addlinkedserver server = N'LinkDBF ', - Name Link Server Free @ srvproduct = N'Visual FoxPro 9 ' @ provider = N'VFPOLEDB ' @ datasrc = N'D: \ DBF \ ', @ provstr = N'VFPOLEDB.1' then Execute 5. Then the Link Server name will be created LinkDBF already be seen in the SQL Server in the Tree Server Object -> Linked Server will be many tables in accordance with existing .dbf file in the folder D: / DBF 6. How do I select or display the contents of .dbf through Query for example, want to display the data from the file penjualan.dbf select * from [LinkDBF] ... sales display data from file pembelian.dbf select * from [LinkDBF] ... purchase With the LinkedServer the dbf file if we can fit our will through SQL Query syntax Source: http://rubahmania.wordpress.com http://nofallen.blogspot.com
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar