Click here to Skip to main content
12,829,660 members (47,285 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL-Server
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 ?

<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" />
Posted 18-Jan-13 2:25am
rflower272
Updated 18-Jan-13 3:46am
v3

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
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 " ?

<?xml version="1.0" encoding="utf-8" ?>
<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)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.170326.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100