?
Solved

SQL PERVASIVE CREATING INDEX GIVES ERROR IN VB6

Posted on 2011-02-19
7
Medium Priority
?
599 Views
Last Modified: 2012-06-27
I use this to create table , works ok
        mystring = "DSN=BIAPRO"          
        dbconn.Open mystring '
        adocat.ActiveConnection = dbconn
        On Error GoTo NoExist                'IF NOT IN TABLE not to delete thus
        klant$ = "MUT01"
        dbconn.Execute ("DROP TABLE " & klant$)

NoExist:
'======
    On Error GoTo Foutje
    strSQL = "CREATE TABLE " & klant$ & "("
    strSQL = strSQL & "MutRecord identity,"
    strSQL = strSQL & "MutYear char(2) NOT NULL,"
    strSQL = strSQL & "MutKlant char(3) NOT NULL,"
    strSQL = strSQL & "MutBoek char(2) NOT NULL,"
    strSQL = strSQL & "MutStuk char(6) NOT NULL,"
    strSQL = strSQL & "MutDate char(6) NOT NULL,"
    strSQL = strSQL & "MutPlace char(1) NOT NULL,"
    strSQL = strSQL & "MutRek char(4) NOT NULL,"
    strSQL = strSQL & "MutBtwFlag char(1) NOT NULL,"
    strSQL = strSQL & "MutBedrag FLOAT NOT NULL,"
    strSQL = strSQL & "MutBtw FLOAT NOT NULL,"
    strSQL = strSQL & "MutReden char(55) NOT NULL,"
    strSQL = strSQL & "wenkilos real NOT NULL,"
    strSQL = strSQL & "MutNewkey char(13) NOT NULL,"
    strSQL = strSQL & "FREEMORE char(151) NOT NULL)"
    dbconn.Execute (strSQL)                 '   ctreate tabel first


but then i need to create index, I do like this in 3 steps

 strSQL = "CREATE UNIQUE INDEX MutRecord ON MUT01 (MutRecord)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

 strSQL = "CREATE INDEX MutNewkey ON  MUT01 (MutNewkey)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

 strSQL = "CREATE INDEX MutBoek  ON  MUT01 (MutBoek)"
 dbconn.Execute (strSQL)
'''GIVES ERROR  ""

0
Comment
Question by:BIAPRO
  • 4
  • 2
7 Comments
 
LVL 18

Expert Comment

by:mirtheil
ID: 34934207
What error?  
You probably don't need to create the key on MutRecord since the field is an Identity and the field should already have an index.  

If you run the queries through PCC, do they work?  
0
 

Author Comment

by:BIAPRO
ID: 34934247
Since I could create the table in my source, after that i entered manualy the index using the pervasive console,
BUT!  i have mut01  upto mut99  and preferre not to do this by hand 99 times

index.jpg
table-names.jpg
0
 
LVL 29

Expert Comment

by:Bill Bach
ID: 34934291
Fyi -- since both field names and index names are stored in the same table (X$File), you cannot have indices with the same names as fields.

I echo Mirtheil's sentiment that you shouldn't need the first one, because of the Field type.
 
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:BIAPRO
ID: 34934339
Ok did retry with only

the get error still:

error.jpg
0
 

Author Comment

by:BIAPRO
ID: 34934345
skipped the 1st index, then got the attached error number
 strSQL = "CREATE INDEX MutNewkey ON  MUT01 (MutNewkey)"
 dbconn.Execute (strSQL)
0
 
LVL 29

Accepted Solution

by:
Bill Bach earned 2000 total points
ID: 34934529
Did you try changing the index name yet?  Add a prefix like "I_" to the start of the index name to make it unique.
0
 

Author Comment

by:BIAPRO
ID: 34934613
Bingo!   that did  the trick!, and true I see the 1st key index generated without my call for key autoinc
Thanks again Bill,

Regards Jack (aruba)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question