Visual Basic.NET
  Home arrow Visual Basic.NET arrow Running a Distributed Query with Visual Ba...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Running a Distributed Query with Visual Basic Using ADO
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2006-07-05

    Table of Contents:
  • Running a Distributed Query with Visual Basic Using ADO
  • Adding a linked server to the SQL 2000 server
  • Running a query against the Linked Server
  • Probing the Linked Server

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Running a Distributed Query with Visual Basic Using ADO


    (Page 1 of 4 )

    A distributed query is a query run against an external database. Linked servers in SQL servers are virtual servers serving the external data. These can be manipulated from the Enterprise Manager and Query Analyzer in SQL 2000 and by the Microsoft SQL Server 2005 management studio. However, managing linked servers from Visual Basic adds an extra, powerful tool for managing or querying linked server objects on SQL servers. This article shows how you may do this.

    Introduction

    In a series of tutorials on ADO (visit the ASPFREE.Com web site and search), the power and extent of the ActiveX Data Objects was described. Although this series is far from complete, readers of this tutorial can benefit from reviewing the previous tutorials first. In this tutorial a connection will be established to the SQL Server and, using an ADODB connection and recordset objects, a series of stored procedures on the server will be executed. These procedures add a named linked server to the Linked Servers folder on the SQL Server and also set up logins. The tutorial, by way of a Visual Basic (ver 6.0) project, also shows how certain properties of the linked server(s) can be obtained.

    Create a Visual Basic Standard EXE Project

    Create a standard EXE project. In this tutorial it is called LinkServer.vbp. Create a form similar to the one shown in this picture. It has three command buttons and four radio buttons.

    The data grid in the above image is added after adding the Data Grid Control. You can add this ActiveX Control MSDATGRD.OCX to your toolbox from Project-->Components and choose the Data Grid Control 6.0 after scrolling in the list as shown. After you add this to the toolbox, drag and drop it on the form and resize it to your requirements.

    Since you will be calling upon the ADODB objects you need to add a reference to the ADO library before you run any code, otherwise you will get a program error. You can add a reference to the ADO library by going to Projects-->References... which opens up a dialog from which you choose, just like you did for the components, by scrolling down the list and placing a check mark against the item as shown. You may or may not have this version, but at least it should be version 2.1. You may download the latest version from Microsoft's web site. For download links refer to my previous tutorials, or search on the Internet.

    More Visual Basic.NET Articles
    More By Jayaram Krishnaswamy


       · The trend in the future is for increased distibuted data as it adds to agility....
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek