Question odbc and paradox 7

bert aalders

Member
Joined
Mar 4, 2011
Messages
16
Programming Experience
Beginner
i am new at VB, i used to programm in Delphi.
now i want to convert my program to VB.
In Delphi it is simpel to connect to a database.
In VB i can not get this right.
What am i doing wrong:

code:

Public Class klant
Private Sub klant_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim odbcverbinding As OdbcConnection
Dim prdxconnString As String = "Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=E:\nog uit pakken\projecten\;Dbq=E:\nog uit pakken\projecten\;CollatingSequence=ASCII"
odbcverbinding = New Odbc.OdbcConnection(prdxconnString)
odbcverbinding.Open()
Dim str As String
str = "select * from test"
Dim ODBCadp As New OdbcDataAdapter(str, odbcverbinding)
Dim dt As New DataTable("test")
ODBCadp.Fill(dt)
Me.DataGridView1.DataSource = dt
Label1.Text =
CStr(Me.DataGridView1.RowCount)
End Sub
End
Class

/code

getting unexpected error

ERROR [HY000] [Microsoft][ODBC Paradox-stuurprogramma] An unexpected error occurred in the driver for the remote database (11265).

Bert

 
It's easy to connect to a database in VB too, but you have to use the appropriate data. You say that you're using Paradox 7 yet you have a connection string that is specifically for Paradox 5. I'm not sure where you got that connection string but www.connectionstrings.com is usually the best source for connection strings. It has one for Paradox 7 with ODBC but I would probably suggest using OLE DB instead anyway.

Paradox Connection String Samples - ConnectionStrings.com
 
changed the string

Imports System.Data.Odbc
Public Class klant
Private Sub klant_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim odbcverbinding As OdbcConnection
Dim prdxconnString As String = "Provider=MSDASQL;" & _
"Persist Security Info=False;" & _
"Mode=Read;" & _
"Extended Properties='DSN=Paradox;DBQ=E:\nog uit pakken\projecten\;" & _
"DefaultDir=E:\nog uit pakken\projecten\;DriverId=538;FIL=Paradox 7.X;MaxBufferSize=2048;PageTimeout=600;';" & _
"Initial Catalog=E:\nog uit pakken\projecten\;"
odbcverbinding = New Odbc.OdbcConnection(prdxconnString)
odbcverbinding.Open()
Dim str As String
str = "select * from test"
Dim ODBCadp As New OdbcDataAdapter(str, odbcverbinding)
Dim dt As New DataTable("test")
ODBCadp.Fill(dt)
Me.DataGridView1.DataSource = dt
Label1.Text =
CStr(Me.DataGridView1.RowCount)
End Sub
End
Class

still having problems, now it is another problem

ERROR [IM002] [Microsoft][ODBC-stuurprogrammabeheer] De naam van de gegevensbron is niet gevonden en er is geen standaardstuurprogramma opgegeven

bert

 
bert aalders said:
De naam van de gegevensbron is niet gevonden en er is geen standaardstuurprogramma opgegeven
use English language when you post here:
Google translate said:
The name of the data source is not found and no default driver specified
 
Private Sub klant_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oledbParadoxconn As New OleDbConnection
Dim sqltext As String
sqltext = "select * from test"
Dim oledbconnstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\nog uit pakken\projecten;Extended Properties=Paradox 7.x;"
oledbParadoxconn.ConnectionString = oledbconnstr
oledbParadoxconn.Open()
Dim myDataAdapter As New OleDbDataAdapter(Sqltext, oledbParadoxconn)
Dim dtgetdata As New DataSet
myDataAdapter.Fill(dtgetdata, "test")
Me.DataGridView1.DataSource = dtgetdata
Me.DataGridView1.DataMember = "test"
Me.Label1.Text = CStr(Me.DataGridView1.RowCount)
End Sub
End
Class


getting bad result,

ERROR [HY000] [Microsoft][ODBC Paradox-stuurprogramma] An unexpected error occurred in the driver for the remote database (11265).


 
Back
Top