Hi!
I have the following snippet that gives the name of the sql servers
installed:
Private Sub MainForm_Load(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles MyBase.Load
'just list local servers, set to false if you want to see all
servers
Dim dataTable = SmoApplication. EnumAvailableSq lServers(False)
lstServers.Valu eMember = "Name"
lstServers.Data Source = dataTable
End Sub
We have only 2 sql server where the client data reside, but then we
have instances of sql installed in other machines.
I only want to be able to show in my listbox for the user to choose,
those with the sql part in their name.
e.g. tg-ny-sql001
tg-ny-sql002
so the condition would be if the name has sql in it show it in the
listbox.
How can I achieve this with VB 2008 and using SQL Server 2000 in the
first server and SQL Server 2005 in the second server?
Thanks in advanced!
Tammy 4 2105
Tammy,
In my idea is that what you need. There is as well a tip for a sqlservers on
one machine. http://www.vb-tips.com/ListComputersAPI.aspx
Cor
<jt*****@gmail. comschreef in bericht
news:50******** *************** ***********@p25 g2000hsf.google groups.com...
Hi!
I have the following snippet that gives the name of the sql servers
installed:
Private Sub MainForm_Load(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles MyBase.Load
'just list local servers, set to false if you want to see all
servers
Dim dataTable = SmoApplication. EnumAvailableSq lServers(False)
lstServers.Valu eMember = "Name"
lstServers.Data Source = dataTable
End Sub
We have only 2 sql server where the client data reside, but then we
have instances of sql installed in other machines.
I only want to be able to show in my listbox for the user to choose,
those with the sql part in their name.
e.g. tg-ny-sql001
tg-ny-sql002
so the condition would be if the name has sql in it show it in the
listbox.
How can I achieve this with VB 2008 and using SQL Server 2000 in the
first server and SQL Server 2005 in the second server?
Thanks in advanced!
Tammy
Cor,
Thank you for your reply, but that does not help me.
I have one listbox that should show me only the sql server that i want
Then i have another listbox which will show me the databases from the
server selected in the previous listbox.
Then I have a third listbox with specific book titles from the
databases selected above.
Here is the code that I have for now:
Imports System
Imports System.Data.Sql Client
Imports System.Collecti ons
Imports System.Data
Imports Microsoft.SqlSe rver
Imports Microsoft.SqlSe rver.Server
Imports Microsoft.SqlSe rver.Management
Imports Microsoft.SqlSe rver.Management .Smo
Public Class Form1
Private Sub MainForm_Load(B yVal sender As System.Object, ByVal e
As System.EventArg s) Handles MyBase.Load
'just list local servers, set to false if you want to see all
servers
Dim dataTable = SmoApplication. EnumAvailableSq lServers(False)
lstServers.Valu eMember = "Name"
lstServers.Data Source = dataTable
End Sub
Private Sub lstServers_Sele ctedIndexChange d(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
lstServers.Sele ctedIndexChange d
lstDatabases.It ems.Clear()
If lstServers.Sele ctedIndex <-1 Then
Dim serverName As String =
lstServers.Sele ctedValue.ToStr ing()
Dim server As Server = New Server(serverNa me)
Try
For Each database As Database In server.Database s
lstDatabases.It ems.Add(databas e.Name)
Next
Catch ex As Exception
Dim exception As String = ex.Message
End Try
End If
End Sub
Private Sub lstDatabases_Cl ick(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles lstDatabases.Cl ick
lstFileSets.Ite ms.Clear()
Dim cn As New SqlClient.SqlCo nnection()
Dim cm As New SqlClient.SqlCo mmand()
Dim dr As SqlClient.SqlDa taReader
With cn
.ConnectionStri ng = "Data Source=" &
lstServers.Sele ctedValue & ";Initial Catalog=" &
lstDatabases.Se lectedValue & ";Integrate d Security=SSPI"
.Open()
End With
With cm
.CommandText = "usp_Search_boo k_titles"
.CommandType = CommandType.Sto redProcedure
.Connection = cn
.Parameters.Add WithValue("@Mat ter",
lstDatabases.Se lectedItem)
End With
dr = cm.ExecuteReade r(CommandBehavi or.CloseConnect ion)
While dr.Read
lstFileSets.Ite ms.Add(dr.Item( 0))
End While
dr.Close()
End Sub
End Class
Unfortunately I need to only show the 2 sql servers and NOT all the
instances in which sql is installed.
sql server names:
e.g. tg-ny-sql001
tg-ny-sql002
I tried incorporating what you suggested but I get a ton of errors. I
am using VB 2008.
Thanks a lot in advanced!!!!
Tammy
Tammy,
Have a look at your subject, I see not any relation with what you write and
that subject, I was answering on your subject.
If you do not step one first the second step can never be done.
Cor
Cor,
As I have it now..it does work, but I do not want the users to see the
rest of the available instances of SQL installed throughout the
network. They only need to see the 2 servers from which they will
select the database etc.
Thanks!
Sorry I am new to VB! :-(((
Tammy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gregory |
last post by:
Hello,
I'm trying to do the above in order to process an image and return the
result to an html image control. It fails and my key suspects are either
the variable that I'm passing in - ImageName - for processing, or the return
data which is done (or not as the case may be) by imagejpeg($img) in the
script, after header("Content-type: image/jpeg").
Any insights would be most welcome, especially debugging techniques and a
pointer to...
|
by: John Dewbert |
last post by:
*** post for FREE via your newsreader at post.newsfeed.com ***
Hello,
I have trouble passing a folder object (from a FileSystemObject) to a sub
procedure.
Consider the following code:
=================================
|
by: Rob Meade |
last post by:
Hi all,
At work we have 2 servers in a cluster for our web apps.
One problem we have experienced (along with many others!) - is that if a
user is logged into one of the applications on server a for example and it
goes offline or fails their session is lost also - even though the
application becomes available on server b.
I have heard that it is possible to either exchange the sessions between
|
by: Richard |
last post by:
**** Post for FREE via your newsreader at post.usenet.com ****
HI,
I am working on a project where I need to input data to a (local) HTML page
using multiple form elements, such as text, radio, checkbox, and dropdown.
When the form Submit button is clicked, I then need the input data either
written to another location on the same page, or written to another page (a
different frame would be fine)
|
by: JJ |
last post by:
Hi,
What's the preferred way to pass variables around to different pages now?
Or if my reading servers me right they are retained in memory for the life of
the app, correct? How do I access these variables if in a different page than
the one variable was created in?
Thanks,
JJ
| |
by: BrendanMcPherson |
last post by:
Hello,
Im try to do some tricks to help make a "Search Many Sites from One
Location".
http://www.act.org.au/b_nexus.htm
What I have decided to do is this:
1. You can choose which site you wish to visit from the first page,
after pressing go it takes you to a frame page.
|
by: Torben Laursen |
last post by:
Hi
I am trying to find find the sqlserver express that is running on my
computer using:
DataTable dtSQLServers = SmoApplication.EnumAvailableSqlServers(false);
It returns one row that holds the name "Office1" but the sqlserver is:
"Office1\SQLExpress"
If I try to connect to "Office1" I get a very long errormessage while if I
|
by: Mike H |
last post by:
I can't seem to figure out the right thing to search on, so I thought
I'd just provide an example and see if someone can point me to some
tips.
What I have is an Automation Server that has a method that will start
another automation server. These Activex automation servers that it
talks to require a specific interface that the calling server uses to
manage the child active x automation servers. This is all part of an
application...
|
by: alan.limebeer |
last post by:
I'm writing a quick and dirty admin tool to check 308 servers for the
Last Modified date of a specific file that exists in the same place on
all 308 servers. Using the System.IO namespace objects to access
FileInfo, I am getting a System.IO.IOException "Logon failure: unknown
user name or bad password. " I want to pass a good user/pass combo
using command-line arguments (no issues there) but I can't figure out
how to get System.IO to use...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |