Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to run a SQL script

Posted on 2011-09-11
7
Medium Priority
?
433 Views
Last Modified: 2012-08-14
I've been developing VB6 apps for many years, and now I have to develop a VB10 (Visual Studio 2010) database app that is to be hosted on the web.

I've created the program, which connects to a local SQL Server database, and it runs ok

I've uploaded the code to a Fasthosts folder via FTP, and I've created a SQL Server database with Fasthosts, which has an IP address, user name and password

What I cannot figure out is how to upload the database schema and data to Fasthosts !!

VS 2010's Database Publishing Wizard let me create a .SQL script file, but how and where do I run it?

I'm sure this is fairly straightforward, but I can't find out what to do next

Grateful for any help
Geoff
0
Comment
Question by:lybreeze
7 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36518913
you have to read the file contents, and use the connection's execute method for the sql.

however, there is a gotcha, if there are lines that are just "GO", you have to split the file contents by the separator, because GO is not t-sql, actually.

hope this clarifies
0
 

Author Comment

by:lybreeze
ID: 36519301
Thanks for your reply.

However, could you please provide a bit more detail about how I go about reading the file contents and using the connection's execute method.  Where am I to do this - in VS 2010 or when connected to Fasthosts?

Thanks
Geoff
0
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 1000 total points
ID: 36519347
what interface do fasthosts provide for you to adminisiter you site/server?

you are probably best to contact there support line.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lybreeze
ID: 36519482
Thank you. I'll give them a call and get back
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 36521639
here some example:
http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/ee667e6d-d34a-48b4-b0f1-de875c183f3f/
check that you get the code that reads the file AND splits by the GO line ...
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1000 total points
ID: 36526396
FastHost has a PDF guide regarding their SQL Server and it appears that you can connect your Management Studio to their servers directly which means you can directly import export stuff

http://help.fasthosts.co.uk/euf/assets/pdf-guides/Getting-started-with-MS-SQL.pdf

http://msdn.microsoft.com/en-us/library/ms141209.aspx
0
 

Author Closing Comment

by:lybreeze
ID: 36554214
Thank you to you all for your help.

I contacted Fasthosts, and they suggested I use SQL Server Management Studio, a link to which is available on their website (although there seems a bit of confusion about the Express and Compact versions - can anyone shine any light on this?)

However, when I tried to install that on my PC with VS2010 it didn't install, probably because VS2010 already includes a copy of SQL Server (accessed via the Server Explorer and Solution Explorer tabs).  The problem is that when I use the SQL Server built into VS2010 it will only connect to a local server, not to a remote one.

I've got round it by installing SQL Server Management Studio on a separate PC, and creating the SQL Server database on that machine.  Nevertheless, I'm sure that I'm missing something here, as it ought to be possible to administer a remote database using VS2010 !!

Thanks again
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Screencast - Getting to Know the Pipeline

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question