Use index of a foxpro table in vb.net

Joined
Sep 12, 2009
Messages
2
Reaction score
0
Hi ,
i have a foxpro table INVENT.dbf. An index is created in this table on the field item_no. This generated a INVENT.IDX file also.
In vb.net application, i am searching for item based on item_no. So i want to use the indexed INVENT.dbf file.
  • How can i create an index on a field from vb.net?. I tried the following, but didnt work
Code:
 [size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] conn [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2][color=#0000ff][size=2][color=#0000ff]New[/color][/size][/color][/size][size=2] System.Data.OleDb.OleDbConnection([/size][size=2][color=#800000][size=2][color=#800000]"Provider=VFPOLEDB;Data Source=D:\AIT;Persist Security Info=False"[/color][/size][/color][/size][size=2])	[/size]
 
[size=2][color=#008000][size=2][color=#008000]Dim Query2 As String = "Create INDEX Idx1 ON INVENT (ITEM_NO)"
 
[/color][/size][/color][/size][size=2][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] Cmd2 = [/size][size=2][color=#0000ff][size=2][color=#0000ff]New[/color][/size][/color][/size][size=2] OleDbCommand(Query2, conn)
 
conn.Open()
 
[/size][size=2]Cmd2.ExecuteNonQuery()
 
conn.Close()
 
[/size][/size]
  • Is there a way to use the foxpro indexed table ?
 
visual foxpro index from vb.net

Hi,
I want to achieve the same result in vb.net which is obtained from foxpro.
in foxpro, the commands used are
HTML:
use invent
index on item_no to itmno

The equivalent i tried to use in vb.net is
HTML:
cn = New System.Data.OleDb.OleDbConnection("Provider=VFPOLEDB.1;Data Source=D:\atitest;Persist Security Info=False")
 
 
 
cn.Open()
 
Dim Query1 As String = "use INVENT"
 
Dim Query2 As String = "index on item tag itemindx"
 
Dim Cmd1 As OleDbCommand = New OleDbCommand(Query1, cn)
 
Dim Cmd2 As OleDbCommand = New OleDbCommand(Query2, cn)
 
Cmd1.ExecuteNonQuery()
 
Cmd2.ExecuteNonQuery()
I am getting exception in the second non query
HTML:
"One or more errors occurred during processing of command
</FONT></I>
 
Back
Top