473,396 Members | 2,052 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,396 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 1122
"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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.