I'm using visual foxpro 7. Here is the code snippet:
----------------------
Imports System.Data
Imports System.Data.OleDb
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim oConn As OleDbConnection
Dim sConnString As String
Dim oCmd As OleDbCommand
Dim oDR As OleDbDataReader
Dim strSQL As String = "select * from accounts"
'FoxPro database connection
sConnString = "provider=VFPOLEDB.1 ;data source= 'C:\...\mydatabase.DBC';password='';user id=''"
oConn = New OleDbConnection(sConnString)
oCmd = New OleDbCommand(strSQL, oConn)
Try
oConn.Open()
'then do something here...., like:
'oDR = oCmd.ExecuteReader()
Catch exc As OleDbException
Response.Write(exc)
Finally
oCmd.Dispose()
If oConn.State = ConnectionState.Open Then
oConn.Close()
End If
oConn.Dispose()
End Try
End sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.