Home All Groups Group Topic Archive Search About

Create my own db connection wizard

Author
19 Apr 2006 4:10 PM
Carlo Stonebanks
I would like my app to have its own run-time data connection wizard so that
users can connect to a data source of their choice. I'm new to ADO.NET,
previously programing for RDO/ODBC. With that, I could actually invoke the
Data Source wizard from the Windows System, browse/edit/add a data source
and then pass it back to the program.

The ODBC technique had the advantage of providing a wizard with the ODBC
provider's own interface, complete with proprietary connection properties
and drivers.

How do I replicate this functionality with ADO.NET?

Carlo

Author
19 Apr 2006 5:47 PM
William (Bill) Vaughn
The ADO.NET 2.0 factory classes can return the "visible" data providers and
the servers/instances of those database providers.
This is a subset of an example from my new book that enumerates the visible
data sources...
Private Sub ShowServerInstances()

' List Providers

Dim tblProviders As Data.DataTable = DbProviderFactories.GetFactoryClasses

DataGridView2.DataSource = tblProviders

' List Server Instances for a selected provider

Dim factory As DbProviderFactory =
DbProviderFactories.GetFactory("System.Data.SqlClient")

Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator

Dim dtInstances As DataTable = dsE.GetDataSources

DataGridView1.DataSource = AddServiceName(dtInstances)

End Sub

hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
news:%23jr%23Dv8YGHA.3848@TK2MSFTNGP05.phx.gbl...
>I would like my app to have its own run-time data connection wizard so that
> users can connect to a data source of their choice. I'm new to ADO.NET,
> previously programing for RDO/ODBC. With that, I could actually invoke the
> Data Source wizard from the Windows System, browse/edit/add a data source
> and then pass it back to the program.
>
> The ODBC technique had the advantage of providing a wizard with the ODBC
> provider's own interface, complete with proprietary connection properties
> and drivers.
>
> How do I replicate this functionality with ADO.NET?
>
> Carlo
>
>
Author
20 Apr 2006 1:10 AM
Carlo Stonebanks
Thanks Bill,

Of course, the first question is: what's the title of the book, and when
will it be published?

The second question is: only the sqlClient has the value
CanCreateDataSourceEnumerator set to true. What can be done about finding
the available data sources for the other providers (particularily ODBC and
OleDb?

Carlo


Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
> The ADO.NET 2.0 factory classes can return the "visible" data providers
> and the servers/instances of those database providers.
> This is a subset of an example from my new book that enumerates the
> visible data sources...
> Private Sub ShowServerInstances()
>
> ' List Providers
>
> Dim tblProviders As Data.DataTable = DbProviderFactories.GetFactoryClasses
>
> DataGridView2.DataSource = tblProviders
>
> ' List Server Instances for a selected provider
>
> Dim factory As DbProviderFactory =
> DbProviderFactories.GetFactory("System.Data.SqlClient")
>
> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>
> Dim dtInstances As DataTable = dsE.GetDataSources
>
> DataGridView1.DataSource = AddServiceName(dtInstances)
>
> End Sub
>
> hth
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
> news:%23jr%23Dv8YGHA.3848@TK2MSFTNGP05.phx.gbl...
>>I would like my app to have its own run-time data connection wizard so
>>that
>> users can connect to a data source of their choice. I'm new to ADO.NET,
>> previously programing for RDO/ODBC. With that, I could actually invoke
>> the
>> Data Source wizard from the Windows System, browse/edit/add a data source
>> and then pass it back to the program.
>>
>> The ODBC technique had the advantage of providing a wizard with the ODBC
>> provider's own interface, complete with proprietary connection properties
>> and drivers.
>>
>> How do I replicate this functionality with ADO.NET?
>>
>> Carlo
>>
>>
>
>
Author
20 Apr 2006 4:26 PM
William (Bill) Vaughn
"Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)".
In the case of ODBC or OLEDB it's going to be more difficult as these
"providers" don't necessarily expose themselves when polled. For example, an
ODBC or OLEDB interface to JET would not have any mechanism to report the
existence of the database. Oracle can do this as it's a "service"-type
server but its OleDb provider must expose this functionality. That's why the
tools in VS make you point to most of these data sources manually to
"register" them.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
news:%233fl4cBZGHA.1200@TK2MSFTNGP03.phx.gbl...
> Thanks Bill,
>
> Of course, the first question is: what's the title of the book, and when
> will it be published?
>
> The second question is: only the sqlClient has the value
> CanCreateDataSourceEnumerator set to true. What can be done about finding
> the available data sources for the other providers (particularily ODBC and
> OleDb?
>
> Carlo
>
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
>> The ADO.NET 2.0 factory classes can return the "visible" data providers
>> and the servers/instances of those database providers.
>> This is a subset of an example from my new book that enumerates the
>> visible data sources...
>> Private Sub ShowServerInstances()
>>
>> ' List Providers
>>
>> Dim tblProviders As Data.DataTable =
>> DbProviderFactories.GetFactoryClasses
>>
>> DataGridView2.DataSource = tblProviders
>>
>> ' List Server Instances for a selected provider
>>
>> Dim factory As DbProviderFactory =
>> DbProviderFactories.GetFactory("System.Data.SqlClient")
>>
>> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>>
>> Dim dtInstances As DataTable = dsE.GetDataSources
>>
>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>
>> End Sub
>>
>> hth
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
>> news:%23jr%23Dv8YGHA.3848@TK2MSFTNGP05.phx.gbl...
>>>I would like my app to have its own run-time data connection wizard so
>>>that
>>> users can connect to a data source of their choice. I'm new to ADO.NET,
>>> previously programing for RDO/ODBC. With that, I could actually invoke
>>> the
>>> Data Source wizard from the Windows System, browse/edit/add a data
>>> source
>>> and then pass it back to the program.
>>>
>>> The ODBC technique had the advantage of providing a wizard with the ODBC
>>> provider's own interface, complete with proprietary connection
>>> properties
>>> and drivers.
>>>
>>> How do I replicate this functionality with ADO.NET?
>>>
>>> Carlo
>>>
>>>
>>
>>
>
>
Author
20 Apr 2006 8:14 PM
james
Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
> The ADO.NET 2.0 factory classes can return the "visible" data providers
> and the servers/instances of those database providers.
> This is a subset of an example from my new book that enumerates the
> visible data sources...
> Private Sub ShowServerInstances()
>
> ' List Providers
>
> Dim tblProviders As Data.DataTable = DbProviderFactories.GetFactoryClasses
>
> DataGridView2.DataSource = tblProviders
>
> ' List Server Instances for a selected provider
>
> Dim factory As DbProviderFactory =
> DbProviderFactories.GetFactory("System.Data.SqlClient")
>
> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>
> Dim dtInstances As DataTable = dsE.GetDataSources
>
> DataGridView1.DataSource = AddServiceName(dtInstances)
>
> End Sub
>
> hth
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________


Hi Bill, sounds like I'll be adding another book to my collection! I can get
your example to work using :
Imports System.Data.Common
But, this line is giving me fits:

DataGridView1.DataSource = AddServiceName(dtInstances)

I get an error that "AddServiceName" is not defined. Looking in the Factory
Class I cannot find a reference to that anywhere.
I know this was a partial example, but, I like trying things to see the
results and besides, there are times I end up needing the info . I can
comment that line out and the rest works great.  But, I am stumped to get
the other part working.
Any free clues ? Or do I need to wait till I get the book ?    :-)

Sorry to (slightly) hijack this thread, I just found the topic interesting
and the example interesting as well.
james
Author
20 Apr 2006 10:15 PM
William (Bill) Vaughn
Ah, that's in another part of the example... sorry for the oversight.
Private Function AddServiceName(ByVal dtLi As DataTable) As DataTable

Dim colService As New DataColumn("ServiceName", GetType(String))

dtLi.Columns.Add(colService)

Dim colState As New DataColumn("Status", GetType(String))

dtLi.Columns.Add(colState)

For Each dr As DataRow In dtLi.Rows

dr("ServiceName") = DBNull.Value

If Not IsDBNull(dr("Version")) Then

dr("ServiceName") = "MSSQL$" & dr("InstanceName")

Else

dr("ServiceName") = "MSSQLSERVER"

End If

dr("Status") = GetStatusForService(dr("ServiceName"), dr("ServerName"))

Next

Return dtLi

End Function





--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"james" <jjames700REMOV***@earthlink.net> wrote in message
news:uDPe1bLZGHA.3496@TK2MSFTNGP05.phx.gbl...
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
>> The ADO.NET 2.0 factory classes can return the "visible" data providers
>> and the servers/instances of those database providers.
>> This is a subset of an example from my new book that enumerates the
>> visible data sources...
>> Private Sub ShowServerInstances()
>>
>> ' List Providers
>>
>> Dim tblProviders As Data.DataTable =
>> DbProviderFactories.GetFactoryClasses
>>
>> DataGridView2.DataSource = tblProviders
>>
>> ' List Server Instances for a selected provider
>>
>> Dim factory As DbProviderFactory =
>> DbProviderFactories.GetFactory("System.Data.SqlClient")
>>
>> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>>
>> Dim dtInstances As DataTable = dsE.GetDataSources
>>
>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>
>> End Sub
>>
>> hth
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>
>
> Hi Bill, sounds like I'll be adding another book to my collection! I can
> get your example to work using :
> Imports System.Data.Common
> But, this line is giving me fits:
>
> DataGridView1.DataSource = AddServiceName(dtInstances)
>
> I get an error that "AddServiceName" is not defined. Looking in the
> Factory Class I cannot find a reference to that anywhere.
> I know this was a partial example, but, I like trying things to see the
> results and besides, there are times I end up needing the info . I can
> comment that line out and the rest works great.  But, I am stumped to get
> the other part working.
> Any free clues ? Or do I need to wait till I get the book ?    :-)
>
> Sorry to (slightly) hijack this thread, I just found the topic interesting
> and the example interesting as well.
> james
>
>
Author
21 Apr 2006 1:09 AM
Carlo Stonebanks
Which in turn begs the question, what does
GetStatusForService() do?

The fun never stops. Aren't you glad you gave your code away?

;-D

Carlo

Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:%23WmKpfMZGHA.4836@TK2MSFTNGP05.phx.gbl...
> Ah, that's in another part of the example... sorry for the oversight.
> Private Function AddServiceName(ByVal dtLi As DataTable) As DataTable
>
> Dim colService As New DataColumn("ServiceName", GetType(String))
>
> dtLi.Columns.Add(colService)
>
> Dim colState As New DataColumn("Status", GetType(String))
>
> dtLi.Columns.Add(colState)
>
> For Each dr As DataRow In dtLi.Rows
>
> dr("ServiceName") = DBNull.Value
>
> If Not IsDBNull(dr("Version")) Then
>
> dr("ServiceName") = "MSSQL$" & dr("InstanceName")
>
> Else
>
> dr("ServiceName") = "MSSQLSERVER"
>
> End If
>
> dr("Status") = GetStatusForService(dr("ServiceName"), dr("ServerName"))
>
> Next
>
> Return dtLi
>
> End Function
>
>
>
>
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "james" <jjames700REMOV***@earthlink.net> wrote in message
> news:uDPe1bLZGHA.3496@TK2MSFTNGP05.phx.gbl...
>>
>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>> news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
>>> The ADO.NET 2.0 factory classes can return the "visible" data providers
>>> and the servers/instances of those database providers.
>>> This is a subset of an example from my new book that enumerates the
>>> visible data sources...
>>> Private Sub ShowServerInstances()
>>>
>>> ' List Providers
>>>
>>> Dim tblProviders As Data.DataTable =
>>> DbProviderFactories.GetFactoryClasses
>>>
>>> DataGridView2.DataSource = tblProviders
>>>
>>> ' List Server Instances for a selected provider
>>>
>>> Dim factory As DbProviderFactory =
>>> DbProviderFactories.GetFactory("System.Data.SqlClient")
>>>
>>> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>>>
>>> Dim dtInstances As DataTable = dsE.GetDataSources
>>>
>>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>>
>>> End Sub
>>>
>>> hth
>>> --
>>> ____________________________________
>>> William (Bill) Vaughn
>>> Author, Mentor, Consultant
>>> Microsoft MVP
>>> INETA Speaker
>>> www.betav.com/blog/billva
>>> www.betav.com
>>> Please reply only to the newsgroup so that others can benefit.
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>> __________________________________
>>
>>
>> Hi Bill, sounds like I'll be adding another book to my collection! I can
>> get your example to work using :
>> Imports System.Data.Common
>> But, this line is giving me fits:
>>
>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>
>> I get an error that "AddServiceName" is not defined. Looking in the
>> Factory Class I cannot find a reference to that anywhere.
>> I know this was a partial example, but, I like trying things to see the
>> results and besides, there are times I end up needing the info . I can
>> comment that line out and the rest works great.  But, I am stumped to get
>> the other part working.
>> Any free clues ? Or do I need to wait till I get the book ?    :-)
>>
>> Sorry to (slightly) hijack this thread, I just found the topic
>> interesting and the example interesting as well.
>> james
>>
>>
>
>
Author
21 Apr 2006 5:22 PM
William (Bill) Vaughn
Oh well. It polls the service status from the ServiceProcess.

Private Function GetStatusForService(ByVal strServiceName As String, ByVal
strServerName As String) As String

Try

Dim Controller As New
System.ServiceProcess.ServiceController(strServiceName, strServerName)

Return Controller.Status.ToString

Catch ex As Exception

Return ex.Message

End Try

End Function


I guess you'll have to come to my VSLive workshop where I'll be showing the
entire code sample. I'll be happy to give you access to the code if you see
me at TechEd Boston. I'll be hanging around the TLC when I'm not eating
lobster somewhere...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
news:eFJMw$NZGHA.1192@TK2MSFTNGP04.phx.gbl...
> Which in turn begs the question, what does
> GetStatusForService() do?
>
> The fun never stops. Aren't you glad you gave your code away?
>
> ;-D
>
> Carlo
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:%23WmKpfMZGHA.4836@TK2MSFTNGP05.phx.gbl...
>> Ah, that's in another part of the example... sorry for the oversight.
>> Private Function AddServiceName(ByVal dtLi As DataTable) As DataTable
>>
>> Dim colService As New DataColumn("ServiceName", GetType(String))
>>
>> dtLi.Columns.Add(colService)
>>
>> Dim colState As New DataColumn("Status", GetType(String))
>>
>> dtLi.Columns.Add(colState)
>>
>> For Each dr As DataRow In dtLi.Rows
>>
>> dr("ServiceName") = DBNull.Value
>>
>> If Not IsDBNull(dr("Version")) Then
>>
>> dr("ServiceName") = "MSSQL$" & dr("InstanceName")
>>
>> Else
>>
>> dr("ServiceName") = "MSSQLSERVER"
>>
>> End If
>>
>> dr("Status") = GetStatusForService(dr("ServiceName"), dr("ServerName"))
>>
>> Next
>>
>> Return dtLi
>>
>> End Function
>>
>>
>>
>>
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "james" <jjames700REMOV***@earthlink.net> wrote in message
>> news:uDPe1bLZGHA.3496@TK2MSFTNGP05.phx.gbl...
>>>
>>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>>> news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
>>>> The ADO.NET 2.0 factory classes can return the "visible" data providers
>>>> and the servers/instances of those database providers.
>>>> This is a subset of an example from my new book that enumerates the
>>>> visible data sources...
>>>> Private Sub ShowServerInstances()
>>>>
>>>> ' List Providers
>>>>
>>>> Dim tblProviders As Data.DataTable =
>>>> DbProviderFactories.GetFactoryClasses
>>>>
>>>> DataGridView2.DataSource = tblProviders
>>>>
>>>> ' List Server Instances for a selected provider
>>>>
>>>> Dim factory As DbProviderFactory =
>>>> DbProviderFactories.GetFactory("System.Data.SqlClient")
>>>>
>>>> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>>>>
>>>> Dim dtInstances As DataTable = dsE.GetDataSources
>>>>
>>>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>>>
>>>> End Sub
>>>>
>>>> hth
>>>> --
>>>> ____________________________________
>>>> William (Bill) Vaughn
>>>> Author, Mentor, Consultant
>>>> Microsoft MVP
>>>> INETA Speaker
>>>> www.betav.com/blog/billva
>>>> www.betav.com
>>>> Please reply only to the newsgroup so that others can benefit.
>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>> rights.
>>>> __________________________________
>>>
>>>
>>> Hi Bill, sounds like I'll be adding another book to my collection! I can
>>> get your example to work using :
>>> Imports System.Data.Common
>>> But, this line is giving me fits:
>>>
>>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>>
>>> I get an error that "AddServiceName" is not defined. Looking in the
>>> Factory Class I cannot find a reference to that anywhere.
>>> I know this was a partial example, but, I like trying things to see the
>>> results and besides, there are times I end up needing the info . I can
>>> comment that line out and the rest works great.  But, I am stumped to
>>> get the other part working.
>>> Any free clues ? Or do I need to wait till I get the book ?    :-)
>>>
>>> Sorry to (slightly) hijack this thread, I just found the topic
>>> interesting and the example interesting as well.
>>> james
>>>
>>>
>>
>>
>
>
Author
22 Apr 2006 2:37 AM
james
Thanks Bill, finally figured out for the "GetStatusForService" function,
that I needed to add a Reference to System.ServiceProccess. Once I did that,
it all works great. (amazing what happens when your forced to think!!)
Thanks again.
james


Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:emMN7gWZGHA.4884@TK2MSFTNGP02.phx.gbl...
> Oh well. It polls the service status from the ServiceProcess.
>
> Private Function GetStatusForService(ByVal strServiceName As String, ByVal
> strServerName As String) As String
>
> Try
>
> Dim Controller As New
> System.ServiceProcess.ServiceController(strServiceName, strServerName)
>
> Return Controller.Status.ToString
>
> Catch ex As Exception
>
> Return ex.Message
>
> End Try
>
> End Function
>
>
> I guess you'll have to come to my VSLive workshop where I'll be showing
> the entire code sample. I'll be happy to give you access to the code if
> you see me at TechEd Boston. I'll be hanging around the TLC when I'm not
> eating lobster somewhere...
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Carlo Stonebanks" <cstoneba***@nissenfasteners.com> wrote in message
> news:eFJMw$NZGHA.1192@TK2MSFTNGP04.phx.gbl...
>> Which in turn begs the question, what does
>> GetStatusForService() do?
>>
>> The fun never stops. Aren't you glad you gave your code away?
>>
>> ;-D
>>
>> Carlo
>>
>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>> news:%23WmKpfMZGHA.4836@TK2MSFTNGP05.phx.gbl...
>>> Ah, that's in another part of the example... sorry for the oversight.
>>> Private Function AddServiceName(ByVal dtLi As DataTable) As DataTable
>>>
>>> Dim colService As New DataColumn("ServiceName", GetType(String))
>>>
>>> dtLi.Columns.Add(colService)
>>>
>>> Dim colState As New DataColumn("Status", GetType(String))
>>>
>>> dtLi.Columns.Add(colState)
>>>
>>> For Each dr As DataRow In dtLi.Rows
>>>
>>> dr("ServiceName") = DBNull.Value
>>>
>>> If Not IsDBNull(dr("Version")) Then
>>>
>>> dr("ServiceName") = "MSSQL$" & dr("InstanceName")
>>>
>>> Else
>>>
>>> dr("ServiceName") = "MSSQLSERVER"
>>>
>>> End If
>>>
>>> dr("Status") = GetStatusForService(dr("ServiceName"), dr("ServerName"))
>>>
>>> Next
>>>
>>> Return dtLi
>>>
>>> End Function
>>>
>>>
>>>
>>>
>>>
>>> --
>>> ____________________________________
>>> William (Bill) Vaughn
>>> Author, Mentor, Consultant
>>> Microsoft MVP
>>> INETA Speaker
>>> www.betav.com/blog/billva
>>> www.betav.com
>>> Please reply only to the newsgroup so that others can benefit.
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>> __________________________________
>>>
>>> "james" <jjames700REMOV***@earthlink.net> wrote in message
>>> news:uDPe1bLZGHA.3496@TK2MSFTNGP05.phx.gbl...
>>>>
>>>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>>>> news:%23UoWKl9YGHA.3936@TK2MSFTNGP05.phx.gbl...
>>>>> The ADO.NET 2.0 factory classes can return the "visible" data
>>>>> providers and the servers/instances of those database providers.
>>>>> This is a subset of an example from my new book that enumerates the
>>>>> visible data sources...
>>>>> Private Sub ShowServerInstances()
>>>>>
>>>>> ' List Providers
>>>>>
>>>>> Dim tblProviders As Data.DataTable =
>>>>> DbProviderFactories.GetFactoryClasses
>>>>>
>>>>> DataGridView2.DataSource = tblProviders
>>>>>
>>>>> ' List Server Instances for a selected provider
>>>>>
>>>>> Dim factory As DbProviderFactory =
>>>>> DbProviderFactories.GetFactory("System.Data.SqlClient")
>>>>>
>>>>> Dim dsE As DbDataSourceEnumerator = factory.CreateDataSourceEnumerator
>>>>>
>>>>> Dim dtInstances As DataTable = dsE.GetDataSources
>>>>>
>>>>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>>>>
>>>>> End Sub
>>>>>
>>>>> hth
>>>>> --
>>>>> ____________________________________
>>>>> William (Bill) Vaughn
>>>>> Author, Mentor, Consultant
>>>>> Microsoft MVP
>>>>> INETA Speaker
>>>>> www.betav.com/blog/billva
>>>>> www.betav.com
>>>>> Please reply only to the newsgroup so that others can benefit.
>>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>>> rights.
>>>>> __________________________________
>>>>
>>>>
>>>> Hi Bill, sounds like I'll be adding another book to my collection! I
>>>> can get your example to work using :
>>>> Imports System.Data.Common
>>>> But, this line is giving me fits:
>>>>
>>>> DataGridView1.DataSource = AddServiceName(dtInstances)
>>>>
>>>> I get an error that "AddServiceName" is not defined. Looking in the
>>>> Factory Class I cannot find a reference to that anywhere.
>>>> I know this was a partial example, but, I like trying things to see the
>>>> results and besides, there are times I end up needing the info . I can
>>>> comment that line out and the rest works great.  But, I am stumped to
>>>> get the other part working.
>>>> Any free clues ? Or do I need to wait till I get the book ?    :-)
>>>>
>>>> Sorry to (slightly) hijack this thread, I just found the topic
>>>> interesting and the example interesting as well.
>>>> james
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
22 Apr 2006 2:44 AM
james
Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:emMN7gWZGHA.4884@TK2MSFTNGP02.phx.gbl...
> I guess you'll have to come to my VSLive workshop where I'll be showing
> the entire code sample. I'll be happy to give you access to the code if
> you see me at TechEd Boston. I'll be hanging around the TLC when I'm not
> eating lobster somewhere...
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________


Wish I could be there Bill. How about this, since you are an INETA speaker,
maybe, you could give a presentation to the Fort Worth DotNet User's Group.
And give a presentation on this subject!! I know that lots of people in our
group would be interested in the subject.  If that's a possibility, I can
get you contact information with our group.
james
Author
22 Apr 2006 4:43 PM
William (Bill) Vaughn
As a matter of fact, I'm going to be in Abilene the week of June 26th to
help my daughter move to Dyess. I would be more than happy to come talk to
your UG that week sometime. Have your people talk to the INETA people ASAP
as they are trying to hook me up with north Texas user groups.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"james" <jjames700REMOV***@earthlink.net> wrote in message
news:eKKHpabZGHA.4920@TK2MSFTNGP02.phx.gbl...
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:emMN7gWZGHA.4884@TK2MSFTNGP02.phx.gbl...
>> I guess you'll have to come to my VSLive workshop where I'll be showing
>> the entire code sample. I'll be happy to give you access to the code if
>> you see me at TechEd Boston. I'll be hanging around the TLC when I'm not
>> eating lobster somewhere...
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>
>
> Wish I could be there Bill. How about this, since you are an INETA
> speaker, maybe, you could give a presentation to the Fort Worth DotNet
> User's Group. And give a presentation on this subject!! I know that lots
> of people in our group would be interested in the subject.  If that's a
> possibility, I can get you contact information with our group.
> james
>
>
Author
23 Apr 2006 2:11 AM
james
Bill, I have forwarded this post , along with a message from me to our
group's president, Stephen Swenton. Hopefully, he can get in touch with you
and INETA and make arrangements for you to speak. Usually, our group meets
the 3rd Tuesday of each month at the Justin Brands Company's office area in
Ft.Worth. There have been a couple of times where the meeting was changed to
accomodate a speaker's schedule or because the meeting room we use was
scheduled for another event.
Hopefully, Stephen can get with you and INETA and work something out.
james

Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:%23bvpbviZGHA.4620@TK2MSFTNGP04.phx.gbl...
> As a matter of fact, I'm going to be in Abilene the week of June 26th to
> help my daughter move to Dyess. I would be more than happy to come talk to
> your UG that week sometime. Have your people talk to the INETA people ASAP
> as they are trying to hook me up with north Texas user groups.
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "james" <jjames700REMOV***@earthlink.net> wrote in message
> news:eKKHpabZGHA.4920@TK2MSFTNGP02.phx.gbl...
>>
>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>> news:emMN7gWZGHA.4884@TK2MSFTNGP02.phx.gbl...
>>> I guess you'll have to come to my VSLive workshop where I'll be showing
>>> the entire code sample. I'll be happy to give you access to the code if
>>> you see me at TechEd Boston. I'll be hanging around the TLC when I'm not
>>> eating lobster somewhere...
>>>
>>> --
>>> ____________________________________
>>> William (Bill) Vaughn
>>> Author, Mentor, Consultant
>>> Microsoft MVP
>>> INETA Speaker
>>> www.betav.com/blog/billva
>>> www.betav.com
>>> Please reply only to the newsgroup so that others can benefit.
>>> This posting is provided "AS IS" with no warranties, and confers no
>>> rights.
>>> __________________________________
>>
>>
>> Wish I could be there Bill. How about this, since you are an INETA
>> speaker, maybe, you could give a presentation to the Fort Worth DotNet
>> User's Group. And give a presentation on this subject!! I know that lots
>> of people in our group would be interested in the subject.  If that's a
>> possibility, I can get you contact information with our group.
>> james
>>
>>
>
>
Author
23 Apr 2006 4:17 AM
William (Bill) Vaughn
If that's the case make sure you pick the topic... ;)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"james" <jjames700REMOV***@earthlink.net> wrote in message
news:%238ru9snZGHA.1132@TK2MSFTNGP05.phx.gbl...
> Bill, I have forwarded this post , along with a message from me to our
> group's president, Stephen Swenton. Hopefully, he can get in touch with
> you and INETA and make arrangements for you to speak. Usually, our group
> meets the 3rd Tuesday of each month at the Justin Brands Company's office
> area in Ft.Worth. There have been a couple of times where the meeting was
> changed to accomodate a speaker's schedule or because the meeting room we
> use was scheduled for another event.
> Hopefully, Stephen can get with you and INETA and work something out.
> james
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:%23bvpbviZGHA.4620@TK2MSFTNGP04.phx.gbl...
>> As a matter of fact, I'm going to be in Abilene the week of June 26th to
>> help my daughter move to Dyess. I would be more than happy to come talk
>> to your UG that week sometime. Have your people talk to the INETA people
>> ASAP as they are trying to hook me up with north Texas user groups.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "james" <jjames700REMOV***@earthlink.net> wrote in message
>> news:eKKHpabZGHA.4920@TK2MSFTNGP02.phx.gbl...
>>>
>>> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
>>> news:emMN7gWZGHA.4884@TK2MSFTNGP02.phx.gbl...
>>>> I guess you'll have to come to my VSLive workshop where I'll be showing
>>>> the entire code sample. I'll be happy to give you access to the code if
>>>> you see me at TechEd Boston. I'll be hanging around the TLC when I'm
>>>> not eating lobster somewhere...
>>>>
>>>> --
>>>> ____________________________________
>>>> William (Bill) Vaughn
>>>> Author, Mentor, Consultant
>>>> Microsoft MVP
>>>> INETA Speaker
>>>> www.betav.com/blog/billva
>>>> www.betav.com
>>>> Please reply only to the newsgroup so that others can benefit.
>>>> This posting is provided "AS IS" with no warranties, and confers no
>>>> rights.
>>>> __________________________________
>>>
>>>
>>> Wish I could be there Bill. How about this, since you are an INETA
>>> speaker, maybe, you could give a presentation to the Fort Worth DotNet
>>> User's Group. And give a presentation on this subject!! I know that lots
>>> of people in our group would be interested in the subject.  If that's a
>>> possibility, I can get you contact information with our group.
>>> james
>>>
>>>
>>
>>
>
>

AddThis Social Bookmark Button