Click here to Skip to main content
16,011,611 members
Home / Discussions / C#
   

C#

 
GeneralRe: windows not in focus Pin
wjp_auhtm17-Jan-10 18:41
wjp_auhtm17-Jan-10 18:41 
AnswerRe: windows not in focus Pin
Heinzzy17-Jan-10 5:47
Heinzzy17-Jan-10 5:47 
GeneralRe: windows not in focus Pin
michaelgr117-Jan-10 6:40
michaelgr117-Jan-10 6:40 
QuestionHow to reject changes between two equal DataTables? Pin
obarahmeh16-Jan-10 21:13
obarahmeh16-Jan-10 21:13 
AnswerRe: How to reject changes between two equal DataTables? Pin
dan!sh 16-Jan-10 21:20
professional dan!sh 16-Jan-10 21:20 
QuestionUSB read Pin
michaelgr116-Jan-10 20:39
michaelgr116-Jan-10 20:39 
AnswerRe: USB read Pin
Alex Manolescu16-Jan-10 21:24
Alex Manolescu16-Jan-10 21:24 
QuestionMicrosoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
Mohammad Dayyan16-Jan-10 20:28
Mohammad Dayyan16-Jan-10 20:28 
Hi,
I'm gonna get a SQL backup with below method :

void BackupDatabase(string sConnect, string dbName, string backUpPath)
{
    using (SqlConnection cnn = new SqlConnection(sConnect))
    {
        cnn.Open();
        dbName = cnn.Database.ToString();

        ServerConnection sc = new ServerConnection(cnn);
        Server sv = new Server(sc);

        // Create backup device item for the backup
        BackupDeviceItem bdi = new BackupDeviceItem(backUpPath, DeviceType.File);

        // Create the backup informaton
        Microsoft.SqlServer.Management.Smo.Backup bk = new Backup();
        bk.PercentComplete += new PercentCompleteEventHandler(percentComplete);
        bk.Devices.Add(bdi);
        bk.Action = BackupActionType.Database;
        bk.PercentCompleteNotification = 1;
        bk.BackupSetDescription = dbName;
        bk.BackupSetName = dbName;
        bk.Database = dbName;
        //bk.ExpirationDate = DateTime.Now.AddDays(30);
        bk.LogTruncation = BackupTruncateLogType.Truncate;
        bk.FormatMedia = false;
        bk.Initialize = true;
        bk.Checksum = true;
        bk.ContinueAfterError = true;
        bk.Incremental = false;

        // Run the backup
        bk.SqlBackup(sv);//Exception
    }
}


But an exception has occurred :
Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server '\\.\pipe\3F103E6E-3FD4-47\tsql\query'


additional info about the Exception:
{Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server '\\.\pipe\3F103E6E-3FD4-47\tsql\query'. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
at Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries, ServerMessageEventHandler dbccMessageHandler, Boolean errorsAsMessages)
at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv)

=== Pre-bind state information ===
LOG: User = MDS-PC\MDS
LOG: DisplayName = Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
(Fully-specified)
LOG: Appbase = file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.SqlServer.ConnectionInfo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\bin\Release\RezaRestaurant.vshost.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser.DLL.
LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser/Microsoft.SqlServer.BatchParser.DLL.
LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser.EXE.
LOG: Attempting download of new URL file:///D:/My Works/C#/Win Form/Reza Restaurant/RezaRestaurant/bin/Release/Microsoft.SqlServer.BatchParser/Microsoft.SqlServer.BatchParser.EXE.

--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Backup.SqlBackup(Server srv)
at RezaRestaurant.Form_تنظیمات_نرم_افزار.BackupDatabase(String sConnect, String dbName, String backUpPath) in D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزار.cs:line 260
at RezaRestaurant.Form_تنظیمات_نرم_افزار.button_تهیه_نسخه_پشتیبان_Click(Object sender, EventArgs e) in D:\My Works\C#\Win Form\Reza Restaurant\RezaRestaurant\Forms\تنظیمات_نرم_افزار.cs:line 177}


Would you please guide me ?
Thanks.
AnswerRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
dan!sh 16-Jan-10 21:15
professional dan!sh 16-Jan-10 21:15 
GeneralRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
Mohammad Dayyan16-Jan-10 21:21
Mohammad Dayyan16-Jan-10 21:21 
GeneralRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
dan!sh 16-Jan-10 21:54
professional dan!sh 16-Jan-10 21:54 
GeneralRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
Mohammad Dayyan16-Jan-10 23:29
Mohammad Dayyan16-Jan-10 23:29 
GeneralRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
dan!sh 16-Jan-10 23:57
professional dan!sh 16-Jan-10 23:57 
GeneralRe: Microsoft.SqlServer.Management.Smo.FailedOperationException: Backup failed for Server ‘\\.\pipe\3F103E6E-3FD4-47\tsql\query’ Pin
Mohammad Dayyan17-Jan-10 0:20
Mohammad Dayyan17-Jan-10 0:20 
Questionwriting a windows service Pin
benams16-Jan-10 20:26
benams16-Jan-10 20:26 
AnswerRe: writing a windows service Pin
dan!sh 16-Jan-10 20:59
professional dan!sh 16-Jan-10 20:59 
GeneralRe: writing a windows service Pin
#realJSOP17-Jan-10 3:25
professional#realJSOP17-Jan-10 3:25 
GeneralRe: writing a windows service Pin
PIEBALDconsult17-Jan-10 5:15
mvePIEBALDconsult17-Jan-10 5:15 
GeneralRe: writing a windows service Pin
dan!sh 17-Jan-10 6:10
professional dan!sh 17-Jan-10 6:10 
GeneralRe: writing a windows service Pin
#realJSOP17-Jan-10 7:19
professional#realJSOP17-Jan-10 7:19 
GeneralRe: writing a windows service Pin
Ravi Bhavnani17-Jan-10 9:33
professionalRavi Bhavnani17-Jan-10 9:33 
GeneralRe: writing a windows service Pin
#realJSOP17-Jan-10 23:52
professional#realJSOP17-Jan-10 23:52 
AnswerRe: writing a windows service Pin
PIEBALDconsult17-Jan-10 5:17
mvePIEBALDconsult17-Jan-10 5:17 
GeneralRe: writing a windows service Pin
#realJSOP17-Jan-10 7:20
professional#realJSOP17-Jan-10 7:20 
Questionsaving images in C# Pin
djsproject16-Jan-10 18:27
djsproject16-Jan-10 18:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.