473,398 Members | 2,335 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,398 software developers and data experts.

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 9614
"Jason" <c_*******@mighty.co.za> wrote in
news:u1*************@TK2MSFTNGP11.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.ExecuteNonQuery(). 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*******************@SkPiAlMl.ctiusa.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"Jason" <c_*******@mighty.co.za> wrote in
news:u1*************@TK2MSFTNGP11.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.ExecuteNonQuery(). 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**********@luckymail.com> wrote in message
news:A6**********************************@microsof t.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_*******@mighty.co.za> wrote in message
news:O2*************@TK2MSFTNGP10.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**********@luckymail.com> wrote in message
news:A6**********************************@microsof t.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_*******@mighty.co.za> wrote in message
news:O2*************@TK2MSFTNGP10.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**********@luckymail.com> wrote in message
news:A6**********************************@microsof t.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
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...
6
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...
1
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...
3
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...
3
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...
2
by: teddybyte | last post by:
my script below is: #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, ...
21
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
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...
13
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...
2
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...
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.