SQL queries


This is what I am doing currently ;
Pulling in a CSV file into memory with 'many'(1000+) records - stripping out one colum. I have a text box to type in the first part of the SQL query and a text box to type any other part of the SQL query that comes after the data to be processed.
THis is output to a file, which I then cut and paste into MSSQL Manager and run. Obviously all I want to do is to remove the cut and paste and save to file part of the operation and output to a file (which I eventualy want to e-mail to someone).
Thanks in advance

Best Regards
ewocksAsked:
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.

mayhewCommented:
So you're already generating the query.

All you want to do is make the connection to your database directly instead of pasting the query into ISQL and then have the results go into a text file?

If you like, I can send you an example of connecting to a database, getting a resultset, and putting the resultset into a text file.

Do you have an ODBC DSN to connect to your database?
0
ewocksAuthor Commented:
Yes please and Yes
0
mayhewCommented:
Post your e-mail address and I'll send you a zipped project.

Since you're using ODBC and SQL Server, I chose RDO as the data access method.

I assumed this was a learning exercise for you so I did everything pretty  deliberately.

Please keep in mind that my code is not the only way to do this.  For example, I defined variables for each field in the table.  This isn't necessary, I just felt that it improved readability.

Also, be sure that your project references the Microsoft Remote Data Object.

You'll need to replace a couple of things in the code with your info, for example, your db uid/password and your DSN.  I marked those parts with comments.

I'll send it as soon as I get your e-mail.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ewocksAuthor Commented:
Thanks very much

paul.cowie@dataflex.co.uk
0
ewocksAuthor Commented:
Thanks for all your help
0
mayhewCommented:
I'm glad I was able to help.

Thanks for the increase!  :)

Let me know if you have any other questions.
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
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.