Click here to Skip to main content
16,012,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,


I Backup and restore in asp.net and sql server using following code (with XML):

----------------------------------------------------------------------
C#
public string RestoreData_to_Database(string tableName, DataSet XmlFileDS)
    {
        try
        {
            DataTable dt = new DataTable();
            dt = XmlFileDS.Tables[0];

            SqlBulkCopy bulkcopy = new SqlBulkCopy(connect.ConnectionString, SqlBulkCopyOptions.KeepIdentity );
            bulkcopy.DestinationTableName = tableName;
            bulkcopy.WriteToServer(dt);
            return "true";
        }
        catch(Exception ex)
        {
            return ex.Message;
        }
        finally
        {
            CloseConnection();
        }   
    }

--------------------------------------------------------

Backup and Restore is OK on localhost, but on a host with plesk control panel,Backup is OK but during restore following error occur :

Login failed for user 'a'.


in advance, Thanks a lot.
Posted
Updated 29-Sep-11 19:52pm
v2

1 solution

Check your connection string to your database.

In a hosted environment you will have to use the credentials you were given.
 
Share this answer
 
Comments
mohammad reza fotoohabadi 30-Sep-11 8:38am    
connection string in Web.config is:

connectionstring="Server=(local);Database=admin;uid=a;pwd=****;"

but not work !?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900