Getting List of SQL server and on selection of server get List of Databases using SMO

Hi,
I need to have functionality where I need to populate List of available SQL servers from local network, and when i select SQL server from list, get the list of Databases from that Server.
For this i referenced SQL SMO Dll's and placed two drop down, one lists Server names, and one lists Database names.
Dlls refered are:
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.SqlClrProvider.dll
Microsoft.SqlServer.SqlEnum.dll
Above DLL's i have copied from SQL server SQL server 2008 installed location
C:\Program Files\Microsoft SQL Server\110\SDK\Assemblies
DLL version : 11.0.3000.0
Code i have used is:
private void MainForm_Load(object sender,
EventArgs e)
   DataTable dataTable = SmoApplication.EnumAvailableSqlServers(false);
   cmbServers.ValueMember = "Name";
   cmbServers.DataSource = dataTable;
//Now, load Databases on selection of Server combo box.
private void cmbServers_SelectedIndexChanged(object sender,
EventArgs e)
   cmbDatabases.Items.Clear();
   if (cmbServers.SelectedIndex != -1)
      string serverName = cmbServers.SelectedValue.ToString();
      Server server = new Server(serverName);
      try
         foreach (Database database in server.Databases)
            cmbDatabases.Items.Add(database.Name);
      catch (Exception ex)
         string exception = ex.Message;
It works where SQL server is installed, but in systems where no SQL server is installed, it is not working, it is not returning list of SQL server and so database list.
Query is> can you please help me in this regard, what i am missing here, do i need to install any client component to use this?, or anything else what i need to do to make this functionality work.
Thanks,
Hemal

Thanks Michael for replying.
I have gone through the reply, and the link on how to get the SMO library installed.
"To install the Client Tooks SDK without installing SQL Server, install Shared Management Objects from the SQL Server feature pack.
If you want to ensure that SQL Server Management Objects is installed on a computer that will run your application, you can use the Shared Management Objects .msi in the SQL Server feature pack."
I have few questions on "Shared Management Objects .msi" 
Where do i get "Shared Management Objects .msi".
only installing this msi will install SMO?.
Can i ship this msi with my application installer?
do i need to install x86 on x86 system and x64 version of msi in x64 system, or x86 can work fine with both, my application
is x86 only.
Thanks,
Hemal

Similar Messages

  • FM to get list of all directories and files on application server..

    Hi All,
    Can anyone tel me FM to get list of all directories and files on application server..i know 'F4_DXFILENAME_TOPRECURSION'
    and '/SAPDMC/LSM_F4_SERVER_FILE' these are working too...but my requirement is when i click F4 i should get list of directories and whn i select one of these the only directory name should display.....and whn click again for 2nd text box field i want file name ...means directory name in one text box field and file name in another....plz help me out..
    helpful answers wil b awarded.
    Thanks,
    Jayshree

    Hi Jayashree
    Please check this FM, SUBST_GET_FILE_LIST. Pass the file path and file name, if it returns an entry in table FILE_LIST, then the filename and path are valid.
    Hope this helps !
    ~ Ranganath

  • List of SQL tables and attributes used in SSRS reports

    Hi,
    I have around 450-500 reports deployed in SSRS reporting server.
    All these reports are built on SQL from multiple databases, and these databases are having unnecessary tables and attributes.
    My requirement is to clean the unused tables and attributes from the databases. For this, I need the list of SQL tables and attributes used in these 450-500 SSRS reports.
    Is there any way to get this data?
    Regards,
    RK

    Hi RK,
    According to your description, you want to get a list of the tables and attributes used in all reports.
    In your scenario, you can query the ReportServer.dbo.Catalog table to get Report name, data source name, dataset name, and query used in the dataset with query below:
    WITH XMLNAMESPACES ( DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition', 'http://schemas.microsoft.com/SQLServer/reporting/reportdesigner' AS rd )
    SELECT ReportName = name
    ,DataSetName = x.value('(@Name)[1]', 'VARCHAR(250)')
    ,DataSourceName = x.value('(Query/DataSourceName)[1]','VARCHAR(250)')
    ,CommandText = x.value('(Query/CommandText)[1]','VARCHAR(250)')
    ,Fields = df.value('(@Name)[1]','VARCHAR(250)')
    ,DataField = df.value('(DataField)[1]','VARCHAR(250)')
    ,DataType = df.value('(rd:TypeName)[1]','VARCHAR(250)')
    --,ConnectionString = x.value('(ConnectionProperties/ConnectString)[1]','VARCHAR(250)')
    FROM ( SELECT C.Name,CONVERT(XML,CONVERT(VARBINARY(MAX),C.Content)) AS reportXML
    FROM ReportServer.dbo.Catalog C
    WHERE C.Content is not null
    AND C.Type = 2
    ) a
    CROSS APPLY reportXML.nodes('/Report/DataSets/DataSet') r ( x )
    CROSS APPLY x.nodes('Fields/Field') f(df)
    ORDER BY name
    For more information, please refer to this similar thread:
    Extract metadata from report server database
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • When installing CS3 Design Premium it instals Version Cue server and shared components, but I get the message "Errors: 6 component (s)" and dose not install, Photoshop, Flash, Illustrator, Indesign or Creative Suite Premium

    When installing CS3 Design Premium it instals Version Cue server and shared components, but I get the message "Errors: 6 component (s)" and dose not install, Photoshop, Flash, Illustrator, Indesign or Creative Suite Premium

    Thank you Bturko in the future only migrate/copy/transfer your documents and settings.  Adobe applications especially are not designed to be transferred from one computer to another.  It is possible to recover however.  I would recommend the following steps:
    Run the uninstaller located in Applications/Utilities/Adobe Installers
    Run the CC Cleaner Tool to ensure complete removal - Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6 - http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html.
    If you need to download a fresh copy of the installation files they can be downloaded at Download CS3 products.
    Run the installer and reinstall Creative Suite 3.

  • High availability for Lync 2013 persistent chat server and office web app server

    I have 1500 users, need HA in primary data center and DR also. looking for HA and DR solution for persistent chat server and office web app server.
    is below correct?
    1. 2 persistent chat server in a pool of primary data center and 1 in DR.  can this be reduced or any changes?
    2. 2 Office web app server in a pool of primary data center and 1 in DR.  can this be reduced or any changes?
     also do i need HLB for both roles?

    1) In Lync Server 2013, there are improvements in both high availability and disaster recovery:
    High availability improvements: SQL Server mirroring is used to provide high availability for the Persistent Chat Server content database and Persistent Chat compliance database within a data center (in-site).
    Disaster recovery improvements: Persistent Chat Server supports a stretched pool architecture that enables a single Persistent Chat Server pool to be stretched across two sites (that is, a single logical pool in the topology, with servers in the pool physically
    located across two sites). SQL Server Log Shipping is used for cross-site disaster recovery.
    For more information about high availability and disaster recovery, see
    Configuring Persistent Chat Server for High Availability and Disaster Recovery in the Deployment documentation.
    2) for HA & DR, you can 2 Office web app server in a pool of primary data center and 1 in DR. and You will need HLB for office web app servers
    http://blogs.technet.com/b/meamcs/archive/2013/03/27/office-web-apps-2013-multi-servers-nlb-installation-and-deployment-for-sharepoint-2013-step-by-step-guide.aspx
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical | Twitter:
    Mai Ali

  • HT201210 Just replaced the battery in my iPhone 4S.  Before doing so I backed-up then wiped the phone.  Now when I go to restore it, it gets about 3/4 done and that is when I get an error message, "Code 1." does this mean I fried it??  :-(

    Hello,
      Just replaced the battery in my iPhone 4S.  Before doing so I backed-up then wiped the phone.  Now when I go to restore it, it gets about 3/4 done and that is when I get an error message, "Code 1." does this mean I fried it??

    Hey joshuafromisr,
    If you resintall iTunes, it should fix the issue. The following document will go over how to remove iTunes fully and then reinstall. Depending on what version of Windows you're running you'll either follow the directions here:
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    http://support.apple.com/kb/HT1925
    or here:
    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923
    Best,
    David

  • HT201320 What am i supposed to put as the incoming mail server and the outgoing mail server when setting up my email?

    I'm tryingt to set up my email through my school account and i'm not sure what it means when i'm asked to enter a incoming mail server and an outgoing mail server. Help would be appreciated thanks

    Since no one here has any idea about what type of mail your school offers...you don't mention what school...your question, as asked, can't be answered. What don't you contact your school's IT dept., or look online. Most schools have instructions on how to do so online.

  • Why does not connect properly macpro my motorola bluetooth headphones S10? I get a connection error message and there is no sound. (I want to use headphones to listen to music via bluetooth from my macpro)

    Why does not connect properly macpro my motorola bluetooth headphones S10?     I get a connection error message and there is no sound.                         (I want to use headphones to listen to music via bluetooth from my macpro)   
    the s10 works perfectly on my ipod touch 4g. 

    this is   
    ERROR HAS OCCURRED Bluetooth audio.
    It failed to establish connection with their
    audio device. make sure it is on and
    in the range. you may need to restart the
      audio section of the program you were using
    STOP USING THE HEADSET WITH MICROPHONE.
    ALSO HAVE A MOTOROLA BLUETOOTH SPEAKERS WHICH EQ5 work seamlessly with the Mac

  • My iphone 4s get wet in water yesterday and now back flash light get stuck and camera also will not open what happen to it ? will you please help me ?

    my iphone get wet in water yesterday and back camera flash light get stucked, how can i recover it ? please help me ?

    What happened is it got wet.  Water and electronics don't go well together.  You need to switch it off and bury it in bag of dry rice for a week at least.  This may or may not work - but continuing to try to use it in its current state will kill it for sure.  You can enquire at an Apple store about out-of-warranty replacement, depending on where you are.

  • [WebLogic 9.2] Please enable the DomainRuntimeMBean Server and the Edit MBean Server

    When trying to log-in into my Admin Console:
    A required MBean Server is disabled which prevents the proper operation of
    the Weblogic Administration Console.
    Please enable the DomainRuntimeMBean Server and the Edit MBean Server in
    this domain's configuration.
    I can't even log-in to the Console, how can I change the domain's
    configuration?
    Thanks in advance!
    Two errors logged to the console:
    Console encountered the following error java.rmi.ServerError: A error
    occurred the server; nested exception is:
    javax.xml.transform.TransformerFactoryConfigurationError: Provider
    org.apache.xalan.processor.TransformerFactoryImpl not found
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:220)
    at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
    at
    weblogic.management.remote.iiop.IIOPServerImpl_922_WLStub.newClient(Unknown
    Source)
    at
    javax.management.remote.rmi.RMIConnector.getConnection(RMIConnector.java:2239)
    at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:271)
    at
    javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
    at
    com.bea.console.utils.MBeanUtils.lookupMBeanServerConnection(MBeanUtils.java:2907)
    at
    com.bea.console.utils.MBeanUtils.getDomainRuntimeMBeanServerConnection(MBeanUtils.java:1594)
    at
    com.bea.console.utils.MBeanUtils.getDomainRuntimeServiceMBean(MBeanUtils.java:1670)
    at
    com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:156)
    at
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    at
    org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:554)
    at
    org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:851)
    at
    org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:630)
    at
    org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:157)
    at
    com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:241)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at
    com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:130)
    at
    org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1169)
    at
    com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:688)
    at
    com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.renderInternal(ScopedContentCommonSupport.java:268)
    at
    com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.render(StrutsStubImpl.java:107)
    at
    com.bea.netuix.servlets.controls.content.NetuiContent.preRender(NetuiContent.java:288)
    at com.bea.netuix.nf.ControlLifecycle$6.visit(ControlLifecycle.java:427)
    at
    com.bea.netuix.nf.ControlTreeWalker.walkRecursivePreRender(ControlTreeWalker.java:708)
    Console encountered the following error
    com.bea.console.exceptions.NoJMXServerException:
    Domain Runtime MBean Server is not enabled. You will need to enable it
    through the JMXMBean.
    at
    com.bea.console.utils.MBeanUtils.getDomainRuntimeServiceMBean(MBeanUtils.java:1677)
    at
    com.bea.console.internal.ConsolePageFlowRequestProcessor.processActionPerform(ConsolePageFlowRequestProcessor.java:156)
    at
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    at
    org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:554)
    at
    org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:851)
    at
    org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:630)
    at
    org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:157)
    at
    com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:241)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at
    com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:130)
    at
    org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1169)
    at
    com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:688)
    at
    com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.renderInternal(ScopedContentCommonSupport.java:268)
    at
    com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.render(StrutsStubImpl.java:107)
    at
    com.bea.netuix.servlets.controls.content.NetuiContent.preRender(NetuiContent.java:288)
    at com.bea.netuix.nf.ControlLifecycle$6.visit(ControlLifecycle.java:427)
    at
    com.bea.netuix.nf.ControlTreeWalker.walkRecursivePreRender(ControlTreeWalker.java:708)
    ...

    Nevermind this, found it myself:
    Some jar files the deployed & running application used, were needed in
    directory \bea\jdk150_10\jre\lib\ext

  • How to store and retrieve blob data type in/from oracle database using JSP

    how to store and retrieve blob data type in/from oracle database using JSP and not using servlet
    thanks

    JSP? Why?
    start here: [http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html]

  • X Serve and link aggregation - how to get more speed

    Based on the thread http://discussions.apple.com/thread.jspa?threadID=1583184
    is there any news with Snow Leopard Server and bonding 2 or 4 nics on an XServe to get a true load balancing? Can you recommend specific ethernet switches?
    Thanks
    Kostas

    Why do you think Snow Leopard makes any difference?
    Link Aggregation is an IEEE standard. Apple can't arbitrarily change their implementation of it.
    As for switches, I've used it successfully on a variety of HP, Cisco and Foundry switches, although since it's a standard protocol almost any switch should work.

  • Can I set an OU to have 2 GPO's one to pull updates from local server and another from replica server

    I'm looking for a solution where I don't change our current AD groups, (avoid using a local group and a field group), also trying to avoid using a server in a DMZ to handle field people (will need to buy a new server).
    At the end i'm looking to use a replica server to push updates from the internet to the field group (or OU with a GPO pointing to such replica server) and use the local server to host the updates locally and push to the office people.
    Probably this is the question that needs to be answered, can an OU group have 2 different GPO's pointing to 2 different WSUS servers (local and replica) (local updates vs updates from internet) and if an user of such group is in the office they get updates
    from the local server and if he is in the field get the updates from the replica server?  I know GPO's can have precedence set to the OU, but do they work like a trigger or something that tells them to go to the next GPO.
    Thanks in advance

    can an OU group have 2 different GPO's pointing to 2 different WSUS servers (local and replica) (local updates vs updates from internet)
    No.
    and if an user of such group is in the office they get updates from the local server and if he is in the field get the updates from the replica server?
    There are two ways to achieve this. Typically we talk about this scenario when the mobile systems are going to use AU/WU to get Security Updates. Taking advantage of the fact that GROUP policy cannot refresh on a machine which is not "in the office", you
    define a Registry Script to run in the user's STARTUP folder, which will set the registry values to configure that client to use the alternate source.
    But, in the case where you have an Internet-facing WSUS server in the DMZ, and a Corporate-facing WSUS server on the LAN, you use the SAME URL, but use DNS to direct the client to the correct IP Address. When the client is on the LAN, the LAN DNS gives the
    IP Address of the Corporate server; when the client is on the Internet, the Internet DNS gives the IP Address of the DMZ server.
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

  • How to Remove a bad mailbox server and add new mailbox server to DAG and copy mailboxes over

    DAG
    2- cas - VM
    2- mbx- physical blade  (mbx1, mbx2)
    5- mailbox databases
    OS: Win 2008 SP2
    Exchange 2010SP3
    Storage: Tegile Disk jbod  Luns
    We have bad disks on mbx1.  our plan is to get a new blade to replace the bad one named mbx3. we need to do this asap since we are running on 1 server without failover capability
    How can I safely:
    1. Add a new mailbox server to the DAG
    2. Copy\Move the databases from the old (passive) server to the new server
    3. Remove the bad mailbox server from DAG

    You'll want to make sure that the new server is on all the same networks that the server you are removing is on, specifically networks that are DAG networks. Also, you'll want to avoid using Windows Network Load Balancing on the new mailbox server
    since it will be part of the DAG. Also, just as you did with the current DAG members, ensure that the disk drive letters match the existing disks that hold databases & logs. Other than that, it's as simple as you have stated.
    1.) Once you have the new mbx server built & configured with the mailbox role, you can use:
    Get-DatabaseAvailabilityGroup "Name of DAG" | Add-DatabaseAvailabilityGroupServer "Name of New MBX Server"
    2.) Add the databases to the new DAG member:
    Add-MailboxDatabaseCopy "name of database" -MailboxServer "name of new DAG member" -ActivationPreference "[you decide based on the server replacing mbx1]"
    3.) Once your databases are Mounted and/or Healthy on the new DAG member, you'll want to remove the databases from the "bad" server (make sure they are all passive on the server first):
    Get-MailboxDatabaseCopy "SERVER\Database" | Remove-MailboxDatabaseCopy
    4.) Once all of the databases are removed from the "bad" DAG member, remove him from the DAG:
    Get-DatabaseAvailabilityGroup "Name of DAG" | Remove-DatabaseAvailabilityGroupServer "Name of old MBX Server"
    Before you pull the blade, uninstall Exchange Server gracefully, as this will save you AD & Exchange headaches later on.
    Petri has a pretty good GUI walk-through for some of the above steps here:
    How to Configure Database Availability Group for Exchange Server 2010
    Woody Colling, MCITP Exchange 2010
    --The incentive for the experts to answer posts is to get their replies marked as helpful, or as the answer to our questions, help them help us, mark posts accordingly--

  • Applet works in Windows Server and not in Unix server

    My friends,
    I have a signed applet working fine in a windows server and a client with win98. When a put this applet in a AIX/Unix server in same win98 client did not work.
    The applet call a program in the client by Runtime.exec and a give "error=0".
    Someone can help me ?

    Show the code with the runtimeexec line.
    Windows file system is different than UNix.
    Windows eg. Runtime.exec (c:/fileToRun.exe)
    *ix eg.          Runtime.exec (fileToRun)                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for