[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL PERVASIVE CREATING INDEX GIVES ERROR IN VB6

Posted on 2011-02-19
7
Medium Priority
?
598 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 28

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
Industry Leaders: 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 28

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 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