Click here to Skip to main content
15,894,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i wanna program a code which is can be a simple example of SQL SERVER 2008 backup/restore in c# which data base not using password and username in its connection string ... i search many projects in google but none of couldn't help me to can make a simple project for backup and restore database sql server... please kindly show me any good complete code which i can create a simple project for my understanding which this program simply run .... many thanks

its back up works right but for restor failed for connect to server ?

XML
<configuration>
    <configsections>
    </configsections>
    <connectionstrings>
        <add name="Alioglu.Util.SqlSrv.BackupRestore.Properties.Settings.masterConnectionString">
            connectionString="Data Source=PERSIAN-PC\SQLEXPRESS;Initial catalog=master;Integrated Security=True;User Instance=True"
            providerName="System.Data.SqlClient" />
    </add></connectionstrings>
  <appsettings>
    <add key="SqlFileLocations" value="C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA" />
  </appsettings>
</configuration>
Posted
Updated 18-Jan-13 2:46am
v3

1 solution

If your server is set up for windows authentication and your C# program runs under an authenticated account, you do not need to give credentials. If not, then there's no way.
 
Share this answer
 
Comments
rflower 18-Jan-13 8:44am    
yes it has set but what i have written why not working in xml for its connection string ... it works right for BACKUP but it given this error for RESTORE Part "Restore Failed for server PERSIAN-PC\SQL-EXPRESS " ?


<configuration>
<configsections>

<connectionstrings>
<add name="Alioglu.Util.SqlSrv.BackupRestore.Properties.Settings.masterConnectionString"
="" connectionstring="Data Source=PERSIAN-PC\SQLEXPRESS;Initial catalog=master;Integrated Security=True;User Instance=True" providername="System.Data.SqlClient">

<appsettings>
<add key="SqlFileLocations" value="C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA">

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