Sql - one table to another

Hi,

I am currently connecting to a Sql Server, using Vb6.
What i am currently doing, is connecting and writing information from a paradox database on my computer to an sql database on a server.
What i would like to do, is write information back to the paradox table, but only certain fields of a particular record.
My problem is, that the fields on my paradox database have spaces between them, and this is causing a problem, eg: Batch Number, but the field on the sql table is ok, saying BatchNo...

This is the sql string i am currently using.

WriteBatch = "INSERT INTO Batch_de" _
 & " (Batch Number,Action Date,Receive Date,Debit Total,Credit Total,Entries,User Code,Total Entries,Errors,Release) VALUES " _
& "('" & WBBatchNo & "','" & WBActionDate & "','" & WBCreationDate & "','" & WBDebitTotal & "','" & WBCreditTotal & "'" _
& ",'" & WBNoOfTrans & "','" & WBUserCode & "','" & 0 & "','" & N & "','" & X & "');"
               
SQLDB.Execute WriteBatch

Basically i think the problem is the spaces between the fields?

Thanks!
mscalaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danlevansCommented:
Try:

WriteBatch = "INSERT INTO Batch_de" _
 & " ([Batch Number],Action Date,Receive Date,Debit Total,Credit Total,Entries,User Code,Total Entries,Errors,Release) VALUES " _
& "('" & WBBatchNo & "','" & WBActionDate & "','" & WBCreationDate & "','" & WBDebitTotal & "','" & WBCreditTotal & "'" _
& ",'" & WBNoOfTrans & "','" & WBUserCode & "','" & 0 & "','" & N & "','" & X & "');"
               
SQLDB.Execute WriteBatch

Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
twardCommented:
Try putting [] (Brackets around the fieldnames with spaces just like you have the first one [Batch Number].
0
twardCommented:
Opps, didn't realize that danlevans had supplied the answer as a comment, for some reason as I scrolled down I thought it was still your question!

In any event danlevans is correct, except you would need to but brackets around all the others as well (that have spaces).
0
danlevansCommented:
Try:

WriteBatch = "INSERT INTO Batch_de" _
 & " ([Batch Number],Action Date,Receive Date,Debit Total,Credit Total,Entries,User Code,Total Entries,Errors,Release) VALUES " _
& "('" & WBBatchNo & "','" & WBActionDate & "','" & WBCreationDate & "','" & WBDebitTotal & "','" & WBCreditTotal & "'" _
& ",'" & WBNoOfTrans & "','" & WBUserCode & "','" & 0 & "','" & N & "','" & X & "');"
               
SQLDB.Execute WriteBatch

Dan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.