Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
QuachNguyen
Starting Member
15 Posts |
Posted - 2007-10-11 : 14:33:29
|
Hi All I'm new comer, I got this function on the internet , and I try to run it , but I got this error . SQLDMO.Backup oBackup = new SQLDMO.BackupClass(); SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass(); oSQLServer.LoginSecure = false; oSQLServer.Connect("localhost", "sa", "852456****258654"); oBackup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database; oBackup.Database = "Northwind"; oBackup.Files = @"C:\\Northwind.bak"; oBackup.BackupSetName = "Northwind"; oBackup.BackupSetDescription = "I don't know this one used for"; oBackup.Initialize = true; oBackup.SQLBackup(oSQLServer); MessageBox.Show("OK"); h.t.t.p://imagesshared.com/images/jdv1192127157z.JPGI'm sure that my userID and my password to login my database is correct , And I also turn on SQL Service before .How can I overcome this problem , I'm going to do my project in my school that having backup and restore database utility .Thanks in advance . |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-10-11 : 15:10:15
|
see if the sql browsr service is running._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-11 : 15:31:38
|
I believe the problem is with your connection string: oSQLServer.Connect("localhost", "sa", "852456****258654");I don't think you can refer to SQL Server as localhost. I believe for a local installation, you use (local). But just specify the hostname instead. Do you know if you installed the default instance or did you specify an instance name? If you specified an instance name, you'll need to use hostname\instancename.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
|
|
QuachNguyen
Starting Member
15 Posts |
Posted - 2007-10-12 : 01:36:16
|
Thanks tkizer, spirit1 for replying . oSQLServer.Connect("localhost", "sa", "852456****258654"); I think this problem occurs in this line , I try to modify this link to oSQLServer.Connect(@"itcsharp\localhost","sa", "852456****258654"); But it still go this error . @spirit1 :I see sql browser service is running in Windown service .Thanks in advance . |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-12 : 01:39:09
|
localhost is most likely not your instancename. Did you install the default instance or a named instance when you installed SQL Server? If you can't remember, then check the SQL Server Configuration Manager tool. Look under SQL Server 2005 Network Configuration. Let us know what you have there.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
|
|
QuachNguyen
Starting Member
15 Posts |
Posted - 2007-10-12 : 02:55:35
|
Now I do it successful . My instance named ITCSHARP , not localhost as the line below . oSQLServer.Connect("ITCSHARP", "sa", "852456****258654"); Thanks tkizer, spirit1, you help me overcome this problem . Thanks |
|
|
|
|
|
|
|