April 18, 2024, 06:04:41 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Trying to install data in table

Started by billhsln, March 19, 2010, 05:39:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

I am trying to load a MDB file with data from a tab delimited file.  I have tried it both ways that I have seen examples of, but it does not seem to be working.  It will create the table, but will not load any data.  I know I must be doing some thing wrong, I just don't see it.

Any help will be appreciated.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

March 19, 2010, 06:36:18 PM #1 Last Edit: March 20, 2010, 12:21:02 AM by Larry McCaughn
Bill

hstmt_insert = dbExecSQL(pdb,ctStmt)
You opened the database with pdbx and you're trying to insert into pdb which isn't open.

LarryMc

EDIT: After looking carefully at your code I see that you had that correct the way you wrote it.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thanks, Larry.  This now comes up with a 42000 error on the insert.  So, still not able to insert data into the table.  I have created the table manually, but would still like to know how to do it thru the program.

Still would appreciate any help getting the data to be loaded.  Will also load a 5 record sample.

Thanks,
Bill
When all else fails, get a bigger hammer.

LarryMc

trying to get a virsu off my grand-daughter's computer.
will look at you problem when I get through

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

I was searching thru some of the replys in this section and came across a note about field names not being the same as key words.   I was using SET as a table name.  Changed it to CardSet and it inserts without any problems.

Just thought I would give out how I found and fixed the problem.

Thanks again, Larry.

As you might be able to tell, I am working on a Cataloging program for my 8 year old Grandson's Pokemon collection.

Take care,
Bill
When all else fails, get a bigger hammer.

LarryMc

I had found that but I was looking at some other stuff too.

Anyway, glad you found it.  You also have to becareful with using columns with fixed sizes and then using STRING variables in your program.

Seems like the feild names are cae sensitive but I might just be dreaming that.

You weren't using dbFreeSQL right before the endwhile like you need to.

Just remember that for every hstmt = dbExecSQL(pdbx,ctStmt)
you have to have a dbFreeSQL( hstmt )
before you can have another hstmt = dbExecSQL(pdbx,ctStmt)


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thanks, Larry.  Your answer caught a problem before I was able to post it.  The program was only allowing 680 inserts and then it quit.  Putting in the dbFreeSQL command fixed that problem and it now enters the entire 4,890 records.

Thanks again,
Bill
When all else fails, get a bigger hammer.