Trying to restore a .bak in C#

J

Jayyde

Can I run a SQL command like:

RESTORE DATABASE NewDB FROM DISK =
'ApplicationStartupPath\SQLSE2005\DevDB.bak' WITH RECOVERY, MOVE
'DevDB_Data' TO 'C:\\Program Files\\Microsoft SQL
Server\\MSSQL.1\\MSSQL\\Data\\NewEB_Data.mdf', MOVE 'DevDB_Log' TO
'C:\\Program Files\\Microsoft SQL
Server\\MSSQL.1\\MSSQL\\Data\\NewDB_Log.ldf'

while connected to the master db installed by default in SQLSE 2005? If not
how the heck do I run this command to restore this db for the client when
they install the app?
 
J

Jayyde

The SqlCommand was actually exactly what I was using, but it threw and
exception as soon as it tried to do the ExecuteNonQuery line.

Could it have anything to do with the fact that I'm using VS 2003 and trying
to restore into SQL 2005? I don't know the explicit relationship between
the 2 programs well enough to know whether or not you absolutely have to
have VS 2005 to do that or if it doesn't really matter.
 
Z

zacks

Jayyde said:
The SqlCommand was actually exactly what I was using, but it threw and
exception as soon as it tried to do the ExecuteNonQuery line.

Could it have anything to do with the fact that I'm using VS 2003 and trying
to restore into SQL 2005? I don't know the explicit relationship between
the 2 programs well enough to know whether or not you absolutely have to
have VS 2005 to do that or if it doesn't really matter.

I don't think there would be any problem using VS2003 and SQL 2005. I
access a SQL2000 server with VS2005 all the time.

I think you would get a better response if you posted the exact
exception that is being thrown.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top