Results 1 to 4 of 4

Thread: Connecting Visual Basic to sql 2005

  1. #1
    Join Date
    Dec 2009
    Posts
    10

    Connecting Visual Basic to sql 2005

    I am working as a freelancer. In my current project I have to upgrade the current version of database from access to SQL Express 2005, so that client can enter the data on their server and simultaneously it can be view on site.
    Problem arises when I tried to connect Visual Basic 6 to SQL Express 2005. Can anybody help me with this problem.
    Last edited by JAMAAL26; 08-12-2009 at 05:41 AM.

  2. #2
    Join Date
    May 2008
    Posts
    2,389

    Re: Connecting Visual Basic to sql 2005

    Perform following steps for connecting Visual Basic 6 to SQL EXPRESS 2005.
    1. Download .Net Framework 3.5
    2. Specify MDAC 2.8" Project -> References -> Select Microsoft ActiveX Data Objects 2.8 library
    3. Type the following query string, assuming that your UserName= ABC and Password = XYZ
    Provider=SQLNCLI.1 in the connection string, such as
    "Provider=SQLNCLI.1;Data Source=DataSourceName;
    User ID=ABC;Password=XYZ"

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: Connecting Visual Basic to sql 2005

    You have import, the database from access and export to SQL Express using its tools.
    This process will save your potential amount of time of creating the database and tables in SQL Express 2005.
    Then use the similar type of query string.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Connecting Visual Basic to sql 2005

    Retrieving SQL Express data into Visual Basic from MHSFLEX GRID
    Try the following snippet.
    Dim cn As ADODB.Connection
    Set cn = New Connection
    cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
    "Persist Security Info=False;" & _
    "AttachDBFileName=" & App.Path & "\northwnd.mdf;Data Source=server1\sqlexpress"
    cn.Open

    Dim rs As Recordset
    Set rs = New Recordset
    rs.Open "Select * from orders", cn
    Set MSHFlexGrid1.DataSource = rs

    Techniques to create views or to display intermediate information while transaction. This technique is known as common table expression.
    Following code snippet will create a common table expression
    WITH CountTerritories(RegionID, TerritoryCount) AS
    (
    SELECT
    RegionID,
    count(*) AS TerritoryCount
    FROM Territories
    GROUP BY RegionID
    )
    SELECT * FROM CountTerritories WHERE TerritoryCount =
    (
    SELECT max(TerritoryCount) FROM CountTerritories
    )

    Temporary view CoutTerritories is created for single select statement.

Similar Threads

  1. How well is supported TBB in Visual Studio 2005
    By Tamonash in forum Software Development
    Replies: 8
    Last Post: 27-09-2010, 11:59 PM
  2. Visual Basic 2005 executable sharing
    By Nitsudge in forum Software Development
    Replies: 3
    Last Post: 27-08-2009, 11:06 PM
  3. Difference between Visual studio 2005 and Visual studio 2008
    By RohanS in forum Software Development
    Replies: 3
    Last Post: 12-06-2009, 10:48 AM
  4. Visual Basic 2005 or Visual Basic 6
    By Aasha in forum Software Development
    Replies: 5
    Last Post: 15-01-2009, 06:56 PM
  5. Want Visual Studio 2005
    By Aashish in forum Software Development
    Replies: 1
    Last Post: 14-11-2008, 02:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,423,667.97625 seconds with 16 queries