|
-
Mar 22nd, 2007, 06:22 AM
#1
Thread Starter
Frenzied Member
[2.0] getting SQL Server name?
is there any way to get the SQL Server Name using the Visual Studio .Net 2005 c#,
i want to connect to sql server 2000 on host which is not my PC and id like to know its name
can i ?
thx alot
Last edited by avrail; Mar 22nd, 2007 at 06:48 AM.
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Mar 22nd, 2007, 09:27 PM
#2
Re: [2.0] getting SQL Server name?
vb Code:
Dim dmo As New SQLDMO.Application
'List all available SQL Servers in the Server field.
For Each server As String In dmo.ListAvailableSQLServers()
Me.serverCombo.Items.Add(server)
Next server
That code is from a VB project of mine but I'm sure you can convert it to C# easily enough. Add a reference to SQLDMO from the COM tab.
-
Mar 22nd, 2007, 09:30 PM
#3
Thread Starter
Frenzied Member
Re: [2.0] getting SQL Server name?
k thanks alot i will try to use this
or something like that in the c#
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Apr 4th, 2007, 06:18 PM
#4
Thread Starter
Frenzied Member
Re: [2.0] getting SQL Server name?
jmcilhinney, hi i was thinking that your code will work fine
well, i think there is som thing i missed but i dont know so i wish you can help me,
this is the error message i get
Code:
Unable to cast COM object of type 'System.__ComObject' to
interface type 'SQLDMO.NameList'. This operation failed because the
QueryInterface call on the COM component for the interface with IID '{
10022406-E260-11CF-AE68-00AA004A34D5}' failed due to the following
error: No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Apr 4th, 2007, 06:18 PM
#5
Thread Starter
Frenzied Member
Re: [2.0] getting SQL Server name?
i found some thin about the sql sever 2000 sp2 and the casting Error prob
if i get it installed on my pc would this help me to solve my prob?
thax alot
Last edited by avrail; Apr 4th, 2007 at 06:24 PM.
You Don't Have to Rate Me.
I'm Not a Civilized Man I'm the Civilization it self
White or Black, Living or Dieing and 0 or 1 that's MY life
iam an Object in Object Oriented Life
my blog : http://refateid.blogspot.com/
twitter : @avrail
010011000111010101110110001000000100110101111001001000000101000001100011 
-
Apr 4th, 2007, 07:46 PM
#6
Re: [2.0] getting SQL Server name?
SP4 has been released for SQL Server 2000. You should be running the most up-to-date version. I can't guarantee that that will fix your issue but you should apply all service packs anyway.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|