Solved

How to run a SQL script

Posted on 2011-09-11
7
425 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 250 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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

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 250 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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