Solved

How to run a SQL script

Posted on 2011-09-11
7
422 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 142

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now