473,785 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL script file and executing it

Hi

I would like to create a .NET app that can receive an SQL script file as
input. it will take the script file and execute it on the database,
depending on what connection properties were entered by the user. best way?

Thanks
Jason

Nov 16 '05 #1
5 9646
"Jason" <c_*******@migh ty.co.za> wrote in
news:u1******** *****@TK2MSFTNG P11.phx.gbl:
Hi

I would like to create a .NET app that can receive an SQL script file
as input. it will take the script file and execute it on the database,
depending on what connection properties were entered by the user. best
way?


Perhaps just read the text in and use SqlConnection.E xecuteNonQuery( ). I
believe (not 100% on this) that it will handle multiple commands just fine
- no need to try to parse it out into separate commands.

-mdb
Nov 16 '05 #2
yeh, my initial thought was that. just thought maybe there was another way
that would be better?

"Michael Bray" <mb************ *******@SkPiAlM l.ctiusa.com> wrote in message
news:Xn******** *************** ***********@207 .46.248.16...
"Jason" <c_*******@migh ty.co.za> wrote in
news:u1******** *****@TK2MSFTNG P11.phx.gbl:
Hi

I would like to create a .NET app that can receive an SQL script file
as input. it will take the script file and execute it on the database,
depending on what connection properties were entered by the user. best
way?


Perhaps just read the text in and use SqlConnection.E xecuteNonQuery( ). I
believe (not 100% on this) that it will handle multiple commands just fine
- no need to try to parse it out into separate commands.

-mdb

Nov 16 '05 #3
ah hmmm

thanks Rasika. yeh i wanna do this :-) because this is for installation
purposes. it is done by the installation program and not by users, if thats
what you mean by your last point?

is there another easier way of deploying databases?

Thanks
Jason

"Rasika" <ra**********@l uckymail.com> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
you can pass the sql string to a stored proc in MSSQL and use the exec function to execute it. But do you really want to do that. People can drop
tables and play all srot of havoc with your DB?
Rasika

Nov 16 '05 #4
Check this one out:
--
Branimir Giurov
MCSD.NET, MCDBA, MCT
eAgility LLC
"Jason" <c_*******@migh ty.co.za> wrote in message
news:O2******** *****@TK2MSFTNG P10.phx.gbl...
ah hmmm

thanks Rasika. yeh i wanna do this :-) because this is for installation
purposes. it is done by the installation program and not by users, if thats what you mean by your last point?

is there another easier way of deploying databases?

Thanks
Jason

"Rasika" <ra**********@l uckymail.com> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
you can pass the sql string to a stored proc in MSSQL and use the exec

function to execute it. But do you really want to do that. People can drop
tables and play all srot of havoc with your DB?

Rasika


Nov 16 '05 #5
Check this one out:

http://msdn.microsoft.com/library/de...l/msdedepl.asp

Cheers,
Branimir

--
Branimir Giurov
MCSD.NET, MCDBA, MCT
eAgility LLC

"Jason" <c_*******@migh ty.co.za> wrote in message
news:O2******** *****@TK2MSFTNG P10.phx.gbl...
ah hmmm

thanks Rasika. yeh i wanna do this :-) because this is for installation
purposes. it is done by the installation program and not by users, if thats what you mean by your last point?

is there another easier way of deploying databases?

Thanks
Jason

"Rasika" <ra**********@l uckymail.com> wrote in message
news:A6******** *************** ***********@mic rosoft.com...
you can pass the sql string to a stored proc in MSSQL and use the exec

function to execute it. But do you really want to do that. People can drop
tables and play all srot of havoc with your DB?

Rasika


Nov 16 '05 #6

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

Similar topics

8
3323
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the hosting available to me for this particular page prohibits me from using php/mysql as i would like. my script works simply by using output buffers and an include the relevant section of code is as follows: ob_start();
6
4030
by: Sandman | last post by:
Ok, so I have PHP set upp to ato_prepend and auto_append files to every script I run. So if I someone surfs to /index.php, these scripts run: init.php -> set up DB connections and stuff. Buffers output index.php -> The current page with it's layout, output is buffered. postprocess.php -> Fetches buffer, applies layout to page. Now, sometimes I want to break the execution of index.php (or whatever page that is...
1
2795
by: Phil | last post by:
Hi, I have my create statments for tables, procedures, views, etc in individual Transact-SQL script files (.sql). I wnat to write another script file that executes these scripts in the correct order to create the database. What is the syntax for executing script files from Transact-SQL?
3
8437
by: Ed Brandmark | last post by:
I have a tag of the form <SCRIPT LANGUAGE="JavaScript1.1" SRC="foo.js"..... and was wondering if this delays the loading of my page until that file foo.js downloads. It seems that if I place this in the HEAD of my document - the page will wait until it downloads. If I place it in the BODY of my document - supposedly the page
3
4988
by: PzYon | last post by:
Hey 2gether! I'm trying to execute a PERL script on the web server when the user presses a button in an ASP.NET Web Application using Visual Basic. The most obvious solution for me seemed to be to use the 'Shell()'-command . This didn't work: Either I get an "File not found" error, or I get no error at all, but the PERL script isn't executed anyway. The strange thing is that I managed to execute a .bat file for example. Why the hell...
2
3384
by: teddybyte | last post by:
my script below is: #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
21
7864
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
3
1956
by: Joshua J. Kugler | last post by:
Yes, I've read this: http://mail.python.org/pipermail/python-list/2006-August/395943.html That's not my problem. I installed PlanetPlanet <http://www.planetplanet.org/via the package's "setup.py install" command (as root). planet.py will not run, however, giving me this error: Traceback (most recent call last): File "/usr/local/bin/planet.py", line 167, in ?
13
12805
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new scripting language that makes writing automated tests simpler. Really, I'm looking to kind of abstract the power of the C# language into a simpler language that's easier to learn. The script files would be interpreted by a script interpreter...
2
1591
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
Hello I'm trying to develop a Windows service, in visual studio 2005, which executes a visual basic script. However, if the script interacts with the file system (as it has to), the script appears to run but doesn't do what it should do (like move files from one folder to another. We really don't want to have to rewrite the script, which uploads content to a web site. However, we want to write a service that watches a folder and...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.