N
n33470
Hey everyone!
I'm trying to use SQLDMO to programmatically attach a database. I
have a problem when the file name includes a space character, for
example: @"C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DM_0814_ABCTrucking.mdf"
Here's a sample of code:
string tmp = @"C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DM_0814_ABCTrucking.mdf" +"," +@"C:\Program
Files\Microsoft SQL Server\MSSQL\Data\DM_0814_ABCTrucking_log.ldf";
SQLDMO.SQLServer sqlDMOConn = new SQLDMO.SQLServer();
sqlDMOConn.Connect("(local)", "sa", "");
sqlDMOConn.AttachDB( "DM_0814_ABCTrucking", tmp );
When I do this, the AttachDB call raised the following exception
"Device Activation Error. The physical file name 'C:\Program' may be
incorrect."
I think what's happening is that SQLDMO doesn't like the space
character in the filenames. How can I formulate the file name
correctly?
--steve
I'm trying to use SQLDMO to programmatically attach a database. I
have a problem when the file name includes a space character, for
example: @"C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DM_0814_ABCTrucking.mdf"
Here's a sample of code:
string tmp = @"C:\Program Files\Microsoft SQL
Server\MSSQL\Data\DM_0814_ABCTrucking.mdf" +"," +@"C:\Program
Files\Microsoft SQL Server\MSSQL\Data\DM_0814_ABCTrucking_log.ldf";
SQLDMO.SQLServer sqlDMOConn = new SQLDMO.SQLServer();
sqlDMOConn.Connect("(local)", "sa", "");
sqlDMOConn.AttachDB( "DM_0814_ABCTrucking", tmp );
When I do this, the AttachDB call raised the following exception
"Device Activation Error. The physical file name 'C:\Program' may be
incorrect."
I think what's happening is that SQLDMO doesn't like the space
character in the filenames. How can I formulate the file name
correctly?
--steve