Showing posts with label similar. Show all posts
Showing posts with label similar. Show all posts

Thursday, March 22, 2012

Detecting SQL Servers on a network

I need to show a list of detected SQL Server 2000 instances installed on a L
AN. I would like to know if anyone knows how to list the servers, similar t
o what Enterprise Manager does with its Server Registration Wizard.
ThanksHi,
From command prompt execute,
ISQL -L
Thanks
Hari
MCDBA
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:983A2E30-10E0-4E3A-BF35-AD0DA6FC7E7A@.microsoft.com...
> I need to show a list of detected SQL Server 2000 instances installed on a
LAN. I would like to know if anyone knows how to list the servers, similar
to what Enterprise Manager does with its Server Registration Wizard.
> Thanks|||Thanks,
Do you have a method that can be done programmatically, rather than from the
command prompt? I need to build this capability into an application for our
developers.
Mike|||SQLDMO
>--Original Message--
>Thanks,
>Do you have a method that can be done programmatically,
rather than from the command prompt? I need to build this
capability into an application for our developers.
>Mike
>.
>|||I believe Enterprise Manager uses the SQLBrowseConnect ODBC function to
enumerate the SQL Servers on a network.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Hi Mike
It would help a great deal if you can supply me with the programming
language that you want this done in.
Regards
Wimpie
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:983A2E30-10E0-4E3A-BF35-AD0DA6FC7E7A@.microsoft.com...
> I need to show a list of detected SQL Server 2000 instances installed on a
LAN. I would like to know if anyone knows how to list the servers, similar
to what Enterprise Manager does with its Server Registration Wizard.
> Thanks|||Me again...
I include the source of one of my VB .Net projects that does this. The is
no need to include any SQL objects in the project since the software
emulates the SQLDMO object in broadcasting a request for identification on
the network.
Hope it helps
Wimpie
----
---
Public Structure ServerInfo
Friend ServerName As String
Friend InstanceName As String
Friend IsClustered As Boolean
Friend Version As String
Friend TCPPort As Long
Friend IPAddress As String
End Structure
Public Sub Start()
Dim objSQLServers() As ServerInfo = EnumSQLServer()
End Sub
Friend Function EnumSQLServer() As ServerInfo()
Dim objUDPClient As New System.Net.Sockets.UdpClient
Dim objRemoteIP As System.Net.IPEndPoint
Dim objAllServers() As ServerInfo
Dim bytData() As Byte = {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0}
Dim bytReceived() As Byte
Dim strInfo() As String
Dim strHostHeaders() As String
Dim booDone As Boolean = False
Dim i As Long
Dim x As Int16
ReDim strHostHeaders(0)
objUDPClient.Send(bytData, 18, "255.255.255.255", "1434")
While booDone = False
Try
bytReceived = objUDPClient.Receive(objRemoteIP)
Catch
booDone = True
Exit While
End Try
If strHostHeaders(strHostHeaders.Length - 1) <> "" Then
ReDim Preserve strHostHeaders(strHostHeaders.Length)
End If
strHostHeaders(strHostHeaders.Length - 1) =
Mid(System.Text.ASCIIEncoding.ASCII.GetString(bytReceived), 4)
strHostHeaders(strHostHeaders.Length - 1) &= ";IPADDRESS;" &
objRemoteIP.Serialize.Item(4).ToString & "." &
objRemoteIP.Serialize.Item(5).ToString & "." &
objRemoteIP.Serialize.Item(6).ToString & "." &
objRemoteIP.Serialize.Item(7).ToString
If strHostHeaders.Length > 1 Then
If strHostHeaders(strHostHeaders.Length - 1) =
strHostHeaders(strHostHeaders.Length - 2) Then ReDim Preserve
strHostHeaders(strHostHeaders.Length - 2)
End If
End While
objUDPClient.Close()
objUDPClient = Nothing
ReDim objAllServers(strHostHeaders.Length - 1)
For i = 0 To strHostHeaders.Length - 1
strInfo = Split(strHostHeaders(i), ";")
For x = 0 To strInfo.Length - 1
Select Case LCase(strInfo(x))
Case "servername"
objAllServers(i).ServerName = strInfo(x + 1)
Case "instancename"
objAllServers(i).InstanceName = strInfo(x + 1)
Case "isclustered"
objAllServers(i).IsClustered = IIf(LCase(strInfo(x +
1)) = "no", False, True)
Case "version"
objAllServers(i).Version = strInfo(x + 1)
Case "tcp"
objAllServers(i).TCPPort = CLng(strInfo(x + 1))
Case "ipaddress"
objAllServers(i).IPAddress = strInfo(x + 1)
End Select
Next
Next
Return objAllServers
End Function

Monday, March 19, 2012

Detail row doesn't repeat!

How do I set the detail row to show all similar records?
I created another report with same exact query and it shows all 25.
Thanks,
TrintPlease provide more details than this for us to be able to help you.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"trint" <trinity.smith@.gmail.com> wrote in message
news:1105127010.082333.226250@.z14g2000cwz.googlegroups.com...
> How do I set the detail row to show all similar records?
> I created another report with same exact query and it shows all 25.
> Thanks,
> Trint
>|||header --> stufff
details--> one row and should be 25.|||header --> stufff
details--> one row and should be 25.|||Sounds like a developer error to me.
You're obviously not eager to work at explaining your problem. Why should
we work to help you solve it?
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"trint" <trinity.smith@.gmail.com> wrote in message
news:1105129238.972872.279370@.c13g2000cwb.googlegroups.com...
> header --> stufff
> details--> one row and should be 25.
>|||Ok,
What is required of a 'detail' row to display multiple instances of
records with, let's say '123' as the first similar column...is that a
setting in the layout?
Thanks,
Trint|||The hide duplicates property.
"trint" wrote:
> Ok,
> What is required of a 'detail' row to display multiple instances of
> records with, let's say '123' as the first similar column...is that a
> setting in the layout?
> Thanks,
> Trint
>

Tuesday, February 14, 2012

deserializing a collection which implements collectionbase

I had a post very similar to this a week or so ago and I received a couple good solutions ... unfortunately, I forgot to mention 1 point that apparently makes a big enough difference so that the solution given won't work. Here's what I originally posted
(and below that is more info):
I'm writing a class in C# ...
I have a collection calls Reports made up of Report objects. I'm trying to deserialize an XML file that looks like :
<Reports>
<Report>
<Title>some title</Title>
<Notes> some notes </Notes>
</Report>
<Report>
blah blah blah
</Report>
</Reports>
I want to be able to deserialize the file in the Reports collection constructor and build the Report objects on the fly. The only examples I've been able to find read the entire XML file outside of the class (which works fine in my test console app), but
I want to be able to be able to dynamically build everything inside the collection class. Do I need to parse through the XML file and got to each <Report> tag and deserialize one Report at a time (and use "this.Add(newReport)")? How can parse the file
like that and pass just that info into the deserialize method? I haven't used XPath, so if I need that, an example would really help.
NOW..........................
what I failed to mention was that my Reports collection implements CollectionBase and now I recieve the following error: "XML attributes may not be specified for the type TestCore.Reports"
I remove the CollectionBase implementation and it works. I've found several websites saying that I can deserialize a class implementing CollectionBase, but I haven't found any examples or help as to what I'm doing wrong. Here's what I have for the colle
ction class using the solution I received in my earlier post (if need be I can post more of my code):
[System.Xml.Serialization.XmlRoot("Reports", Namespace="", IsNullable=false)]
[System.Xml.Serialization.XmlType("Reports", Namespace="")]
public class Reports : CollectionBase
{
[System.Xml.Serialization.XmlElementAttribute "Report",Form=System.Xml.Schema.XmlSchemaForm.Unqu alified)]
public Report[] Items1;
public Reports() {}
public Reports(string path)
{
Reports temp= Reports.CreateFromString(path);
Items1= temp.Items1; // shallow copy of array. Would need to do this for each field in the RC type
// "temp" now goes out of scope but the Items array gets referenced by "this"
}
public static Reports CreateFromString(string xml1)
{
// could parameterize this with a filename, a stream, a string,whatever
XmlSerializer s1 = new XmlSerializer(typeof(Reports));
// slurp it in: deserialize the original XML into a value
System.IO.StringReader sr= new System.IO.StringReader(xml1);
Reports rc= (Reports) s1.Deserialize(new System.Xml.XmlTextReader(sr));
return rc;
}
public int Add(Report report)
{
return List.Add(report);
}
public Report this[int index]
{
get
{
return((Report)List[index]);
}
set
{
List[index] = value;
}
}
}
You need to remove the attributes from the class that derives from
CollectionBase.
The side effect of this is that your collection will now serialize as
<ArrayOfReport>
<Report>...</Report>
...
</ArrayOfReport>
Rather than what you wanted, which was:
<Reports>
<Report>...</Report>
...
</Reports>
To work around this you can specify an XmlRootAttribute() in the serializer.
See here for an example that combines the answer to your 2 most recent asks
(self-instantiation and serializing a CollectionBase):
http://www.winisp.net/cheeso/srcview...lectionBase.cs
Note that the copy in the parameterized constructor is different in this
code that in the prior code, because the "Items1" field is not used. So
here you gotta iterate to do the copy.
-D
Dino Chiesa
Microsoft Developer Division
d i n o c h @. OmitThis . m i c r o s o f t . c o m
"Greg" <Greg@.discussions.microsoft.com> wrote in message
news:59CCBFD6-29FB-40A1-9B9D-09F6A98A983E@.microsoft.com...
> I had a post very similar to this a week or so ago and I received a couple
good solutions ... unfortunately, I forgot to mention 1 point that
apparently makes a big enough difference so that the solution given won't
work. Here's what I originally posted (and below that is more info):
> I'm writing a class in C# ...
> I have a collection calls Reports made up of Report objects. I'm trying
to deserialize an XML file that looks like :
> <Reports>
> <Report>
> <Title>some title</Title>
> <Notes> some notes </Notes>
> </Report>
> <Report>
> blah blah blah
> </Report>
> </Reports>
> I want to be able to deserialize the file in the Reports collection
constructor and build the Report objects on the fly. The only examples I've
been able to find read the entire XML file outside of the class (which works
fine in my test console app), but I want to be able to be able to
dynamically build everything inside the collection class. Do I need to
parse through the XML file and got to each <Report> tag and deserialize one
Report at a time (and use "this.Add(newReport)")? How can parse the file
like that and pass just that info into the deserialize method? I haven't
used XPath, so if I need that, an example would really help.
> NOW..........................
> what I failed to mention was that my Reports collection implements
CollectionBase and now I recieve the following error: "XML attributes may
not be specified for the type TestCore.Reports"
> I remove the CollectionBase implementation and it works. I've found
several websites saying that I can deserialize a class implementing
CollectionBase, but I haven't found any examples or help as to what I'm
doing wrong. Here's what I have for the collection class using the solution
I received in my earlier post (if need be I can post more of my code):
> [System.Xml.Serialization.XmlRoot("Reports", Namespace="",
IsNullable=false)]
> [System.Xml.Serialization.XmlType("Reports", Namespace="")]
> public class Reports : CollectionBase
> {
> [System.Xml.Serialization.XmlElementAttribute
"Report",Form=System.Xml.Schema.XmlSchemaForm.Unqu alified)]
> public Report[] Items1;
> public Reports() {}
> public Reports(string path)
> {
> Reports temp= Reports.CreateFromString(path);
> Items1= temp.Items1; // shallow copy of array. Would need to do
this for each field in the RC type
> // "temp" now goes out of scope but the Items array gets
referenced by "this"
> }
> public static Reports CreateFromString(string xml1)
> {
> // could parameterize this with a filename, a stream, a string,
whatever
> XmlSerializer s1 = new XmlSerializer(typeof(Reports));
> // slurp it in: deserialize the original XML into a value
> System.IO.StringReader sr= new System.IO.StringReader(xml1);
> Reports rc= (Reports) s1.Deserialize(new
System.Xml.XmlTextReader(sr));
> return rc;
> }
> public int Add(Report report)
> {
> return List.Add(report);
> }
> public Report this[int index]
> {
> get
> {
> return((Report)List[index]);
> }
> set
> {
> List[index] = value;
> }
> }
> }
>