473,382 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Executing a .SQL file from disk through C#

I have the disk file c:\mydir\myfile.sql which has some commands in it to
create
and populate a table.

I could use Query Manager or OSQL, but I need to do it from inside my C#
application.

Is this possible and if so how? Obviously I could open the file, read it,
and then execute it with
ExecuteNonQuery, but this is inelegant and I'm not sure it would work if
myfile.sql had more
than one statement (seperated by GO) in it.

Thanks in advance.
Chris Hough
Nov 15 '05 #1
0 921

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xilo Musimene | last post by:
Hi there, I'm programming an archiving class and the archive is currently able to read files, concatenate them in one and compress the archive (or specific files that can be compressed) with the...
7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
9
by: Jon LaBadie | last post by:
Suppose I'm using stdio calls to write to a disk file. One possible error condition is no space on file system or even (in unix environment) a ulimit of 0 bytes. Which calls would be expected to...
0
by: Valerie Hough | last post by:
I have the disk file c:\mydir\myfile.sql which has some commands in it to create and populate a table. I could use Query Manager or OSQL, but I need to do it from inside my C# application. ...
4
by: Sampriti | last post by:
I am trying to delete a file from a disk when the user's session ends. So I am putting my file.delete code in Session_End event. I ran the application in the debug mode. When the session timesout...
6
by: Chris | last post by:
Could someone point me to an example or at least outline of a solution to the following problem: I want to be able to compile the body of a method written in C++, submitted by a possibly...
10
by: gum | last post by:
Other than argv is there a way to obtain the name of the executable programatically?
2
by: Mark | last post by:
hi, i've written a c++ program that converts one file type to another via two arguments (the input and output filenames). i want to execute this on my server, using something like ...
10
by: brett | last post by:
I'm doing a file include as <?php $content = file_get_contents(TEMPLATEPATH . '/somefile.php'); echo $content; ?> In somefile.php, there is PHP code. How can I execute the code once $content...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.