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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create index in OLEDB 1

Status
Not open for further replies.

Fred48

Programmer
Feb 23, 2004
62
US
Hi,
I am in the process of converting ADODB to OLEBD and I need advice on how to create an index for my datebase. Below is the code to create the database:


strCMD = "CREATE TABLE SelCrit (" & _
"TRENDING_METHOD varchar (1)," & _
.
.
"TGSN_7 varchar (8)," & _
"TGSN_8 varchar (8)," & _
"TGSN_9 varchar (8)," & _
"TGSN_10 varchar (8)," & _
"PENDING varchar (1))"

cnn = New OleDbConnection(PrepareDBConnectStr(AppDir & "TREND.MDB"))
Dim cmdDatabase As OleDbCommand = New OleDbCommand(strCMD, cnn)
cnn.Open()
cmdDatabase.ExecuteNonQuery()
cnn.Close()

I need to create an index for TGSN_10. I could not find anything on the Web.

Thanks
 
Sorry about that. I am using Microsoft Access Version 2003.
 
Run an OLEDBCommand with the following CommandText:
Code:
CREATE INDEX idx_TGSN_10 ON SelCrit(TGSN_10)

You might alter the syntax if the index it creates is of a different type than you need.
 
Thanks for the inforamtion, it worked of course. Now, how do I specify for the Index No Duplicates?
 
Code:
CREATE [COLOR=#ff0000][b]UNIQUE[/b][/color] INDEX idx_TGSN_10 ON SelCrit(TGSN_10)

seems to work
 
Riverguy,

Thanks again for you valuable help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top