Hi there,
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