473,395 Members | 1,639 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,395 software developers and data experts.

running an .sql script from an asp.net web page

I have the asp.net source of a web application. ( from a great asp.net
book by Wrox )

http://www.amazon.com/exec/obidos/tg...books&n=507846

The source code includes an sql script that is run to create the
database used by the application.

contains sql stmts like this:
----------------------------------------------
use master
go

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name =
N'IBuyAdventure')
DROP DATABASE [IBuyAdventure]
GO

CREATE DATABASE IBuyAdventure
GO

exec sp_dboption N'IBuyAdventure', N'autoclose', N'false'
GO
-----------------------------------------------

I used osql to run the script on my PC and everything worked ok.

Now I want to install this web application at my shared hosted web
site. ( as a demo of the great work I can do! )

Is it normal to be able to run "osql" on a shared hosting site like
GoDaddy.com?

If I cant run the script that way, can I run it from .net somehow?

Worst case I would be able to translate the script to a series of
"ExecNonQuery" type method calls, correct? Even the "sp_" stored
procedures can be run that way?

thanks,

-Steve

Nov 19 '05 #1
3 1380
i doubt if they allow osql, as this would require their sqlsever to open to
the internet. an asp.net page might spawn osql, or you can write your own
sql script page- post a file, and run it . in osql the "go"'s terminate a
batch, so all statments between go's must be sent together

-- bruce (sqlwork.com)

"Steve Richter" <St************@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I have the asp.net source of a web application. ( from a great asp.net
book by Wrox )

http://www.amazon.com/exec/obidos/tg...books&n=507846

The source code includes an sql script that is run to create the
database used by the application.

contains sql stmts like this:
----------------------------------------------
use master
go

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name =
N'IBuyAdventure')
DROP DATABASE [IBuyAdventure]
GO

CREATE DATABASE IBuyAdventure
GO

exec sp_dboption N'IBuyAdventure', N'autoclose', N'false'
GO
-----------------------------------------------

I used osql to run the script on my PC and everything worked ok.

Now I want to install this web application at my shared hosted web
site. ( as a demo of the great work I can do! )

Is it normal to be able to run "osql" on a shared hosting site like
GoDaddy.com?

If I cant run the script that way, can I run it from .net somehow?

Worst case I would be able to translate the script to a series of
"ExecNonQuery" type method calls, correct? Even the "sp_" stored
procedures can be run that way?

thanks,

-Steve

Nov 19 '05 #2

Bruce Barker wrote:
i doubt if they allow osql, as this would require their sqlsever to open to the internet. an asp.net page might spawn osql, or you can write your own
sql script page- post a file, and run it .
what do you mean? run the sql script stmts one at a time like so:

SqlConnection conn ;
SqlCommand cmd ;
conn = new SqlConnection( "Server='xxxx';trusted_connection=true;
database='abc'" ) ;
conn.Open( ) ;
cmd = new SqlCommand( "DROP TABLE DemoTable", conn ) ;
cmd.ExecuteNonQuery() ;

thanks,

-Steve

in osql the "go"'s terminate a
batch, so all statments between go's must be sent together

-- bruce (sqlwork.com)

"Steve Richter" <St************@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I have the asp.net source of a web application. ( from a great asp.net book by Wrox )

http://www.amazon.com/exec/obidos/tg...books&n=507846
The source code includes an sql script that is run to create the
database used by the application.

contains sql stmts like this:
----------------------------------------------
use master
go

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name =
N'IBuyAdventure')
DROP DATABASE [IBuyAdventure]
GO

CREATE DATABASE IBuyAdventure
GO

exec sp_dboption N'IBuyAdventure', N'autoclose', N'false'
GO
-----------------------------------------------

I used osql to run the script on my PC and everything worked ok.

Now I want to install this web application at my shared hosted web
site. ( as a demo of the great work I can do! )

Is it normal to be able to run "osql" on a shared hosting site like
GoDaddy.com?

If I cant run the script that way, can I run it from .net somehow?

Worst case I would be able to translate the script to a series of
"ExecNonQuery" type method calls, correct? Even the "sp_" stored
procedures can be run that way?

thanks,

-Steve


Nov 19 '05 #3
In this case, its better to create a stored procedure with all the script,
and run the stored procedure from the ExecuteNonQuery method.

"Steve Richter" wrote:

Bruce Barker wrote:
i doubt if they allow osql, as this would require their sqlsever to

open to
the internet. an asp.net page might spawn osql,

or you can write your own
sql script page- post a file, and run it .


what do you mean? run the sql script stmts one at a time like so:

SqlConnection conn ;
SqlCommand cmd ;
conn = new SqlConnection( "Server='xxxx';trusted_connection=true;
database='abc'" ) ;
conn.Open( ) ;
cmd = new SqlCommand( "DROP TABLE DemoTable", conn ) ;
cmd.ExecuteNonQuery() ;

thanks,

-Steve

in osql the "go"'s terminate a
batch, so all statments between go's must be sent together

-- bruce (sqlwork.com)

"Steve Richter" <St************@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I have the asp.net source of a web application. ( from a great asp.net book by Wrox )

http://www.amazon.com/exec/obidos/tg...books&n=507846
The source code includes an sql script that is run to create the
database used by the application.

contains sql stmts like this:
----------------------------------------------
use master
go

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name =
N'IBuyAdventure')
DROP DATABASE [IBuyAdventure]
GO

CREATE DATABASE IBuyAdventure
GO

exec sp_dboption N'IBuyAdventure', N'autoclose', N'false'
GO
-----------------------------------------------

I used osql to run the script on my PC and everything worked ok.

Now I want to install this web application at my shared hosted web
site. ( as a demo of the great work I can do! )

Is it normal to be able to run "osql" on a shared hosting site like
GoDaddy.com?

If I cant run the script that way, can I run it from .net somehow?

Worst case I would be able to translate the script to a series of
"ExecNonQuery" type method calls, correct? Even the "sp_" stored
procedures can be run that way?

thanks,

-Steve


Nov 19 '05 #4

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...
4
by: Damien Renwick | last post by:
I have a php script which simply stops midway through a while loop that processes records returned by a MySQL query. The HTML page continues trying to load the page but the php has stopped running...
5
by: GB | last post by:
Okay, here is what I am trying to do We have a dialog of windows that collects information for generation of a dynamic HTML report. The last page in the wizard dialog accepts all report options...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
4
by: benwylie | last post by:
I am running IIS 6.0 on Windows 2003. I would like to be able to run a perl script from a web page and include the output. I have tried doing it with an ssi: <form action='docsearch.shtml'...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
0
by: sbhandary | last post by:
Hi, I have an ASP.net page that takes over an hour and sometimes more to execute. After the page has been running for 60 minutes, I get a Page Cannot Be Displayed error. I have set the session...
5
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
4
by: Christoph | last post by:
A while ago, I implemented an AJAX-based progress bar on a web page that executed a lengthy server operation. The web page was a Java servlet on a Tomcat server. The progress bar worked by...
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: 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
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
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...
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.