views:

43

answers:

0

Hi, I'm writing an ASP.NET app in c# that will allow users to upload databases from local sql 2005 server to a remote sql server.

The code does not run directly on the local sql server, it runs on an adjacent server. The error I receive when I run the code is:

ERROR : errorCode=-1073659874 description=The file name "C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\SQL Server\Smo\NonTransactable1481210533.sql" specified in the connection was not valid. helpFile= helpContext=0 idofInterfaceWithError={8BDFE898-E9D8-4D23-9739-DA807BCDC2AC}

The error happens on the TransferData call.

Server mySourceServer = new Server(@"localSQLserver");
    mySourceServer.ConnectionContext.LoginSecure = false;
    mySourceServer.ConnectionContext.Login = "sa"; 
    mySourceServer.ConnectionContext.Password = "password";
    mySourceServer.ConnectionContext.Connect();

    Database dbSource = mySourceServer.Databases["sourceDatabase"];


    Transfer trsfrDB = new Transfer(dbSource);

    trsfrDB.DestinationLoginSecure = false;
    trsfrDB.DestinationServer = "remoteSQLServer";
    trsfrDB.DestinationDatabase = "remoteDatabase";
    trsfrDB.DestinationLogin = "username";
    trsfrDB.DestinationPassword = "password";

    trsfrDB.CopyAllObjects = false;
    trsfrDB.CopyAllSchemas = true;

    //Copy all tables from source to destination 
    trsfrDB.CopyAllTables = true;
    //Copy data of all source tables to destination tables 
    trsfrDB.CopyData = true;

    trsfrDB.TransferData();