Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbasic 6 + Pervasive(Microkernel) -->Read Indexes Properties

Status
Not open for further replies.

blackmonk

Programmer
May 14, 2003
2
ES
Hello!! I´m write from Spain because I have a little problem with Pervasive. This is actual code from my program:



Private Sub Command2_Click()

Set base = OpenDatabase("ejemplo3", False, False, "ODBC; DSN=basedatos")
Set Tabla = base!tabla1

If Tabla.Indexes.Count = 0 Then
etiqueta.Caption = "WITHOUT INDEX"
Exit Sub
End If
For i = 0 To Tabla.Indexes.Count - 1
etiqueta.Caption = etiqueta.Caption & vbCrLf & "indice: " & UCase(Tabla.Indexes(i).Name) & vbCrLf & "campos: " & vbCrLf
cadena = Trim(Tabla.Indexes(i).Fields)
tamaño = Len(cadena)
posicion = 1
While posicion <= tamaño
pos = InStr(posicion, cadena, &quot;;&quot;)
If pos <> 0 Then
palabra = Mid(cadena, posicion, pos - posicion)
If palabra <> &quot;&quot; Then
palabra = Mid(palabra, 2, Len(palabra))
etiqueta.Caption = etiqueta.Caption & palabra & vbCrLf
End If
posicion = pos + 1
Else
etiqueta.Caption = etiqueta.Caption & Mid(cadena, posicion + 1)
posicion = tamaño + 1
End If
Wend
Next

End Sub


It´s a ODBC conection between Vbasic 6.0 and Pervasive but I need the same with Pervasive´s MicroKernel. How can I get it??
Now I conect Vbasic and Pervasive´s Microkernel with this sentence:

Dim cnn As New Connection
cnn.Open &quot;Provider=PervasiveOLEDB; Data source=basedatos&quot;

but I can´t read indexes properties like previous example.

I need the same thing that in the first example with the second conection. THANKS!!
 
Are indexes actually defined on the Pervasive Database? I've seen where some databases don't have any indexes. Also, if you change to:
Dim cnn as New Connection
cnn.Open &quot;DSN=dasedatos&quot;
Does that show the indexes?

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
With the first example I can read from the table : index name and all properties from indexes but with second connection I only can read fields from the same table, can I read name and properties from indexes with the second connection?

Structure from database:

Database name --> EXAMPLE
Tables from database --> NAMES
Columns from NAMES: u_1 | u_2 | u_3
Indexes from Tables --> INDEX1,INDEX2,INDEX3

Columns
INDEX1 --> u_1,u_2
INDEX2 --> u_3
INDEX3 --> u_1,u_2,u_3

With this connection (ODBC conection):

Dim base As Database
Dim Tabla As TableDef
Set base = OpenDatabase(&quot;example&quot;, False, False, &quot;ODBC; DSN=basedatos&quot;)
Set Tabla = base!names
..........
..........
(code from first example)
..........
..........

I can use: .INDEXES property in VBasic and I can read all indexes but with the other connection I can´t see this property. How can I get read properties with the other conection (MicroKernel conection)?

Sorry because my english is too bad.



 
I understand that the code doesn't show anything but if you use one of the Pervasive Utilities like the Pervasive Control Center/Table Designer, do you see indexes?
You don't say what version of Pervasive/Btrieve you're using. It could be that the Pervasive database you're using doesn't have any indexes on it.

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top