/* ------------------------ My Meta Content Here SEO ------------------------ */

Pages

Main Menu

Wednesday, December 7, 2011

Sql Server Connection Module in VB 6.0

**************************************************  
Global conn As New adodb.connection
Global con As New adodb.connection
Global pconn As New adodb.connection
Global rs As New adodb.Recordset
Global app_path As String
Global server_name As String
Global server_username As String
Global server_password As String
Global userName As String

Public Sub connect()  
    If conn.State = 1 Then conn.Close
    app_path = "C:\Program Files\Microsoft Visual Studio\VB98\"
  
    server_name = "your server name data source"
    server_username = "dbusername"
    server_password = "dbpassword"

    Call OpenConnection
   
    ''******* connection ***********
    If pconn.State = adStateOpen Then pconn.Close
    pconn.CursorLocation = adUseClient
    pconn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & server_username & ";pwd=" & server_password & ";Initial Catalog=Your DataBase Name;Data Source= " & server_name
    pconn.Open 
End Sub
**************************************************

1 comment:

  1. http://www.akadia.com/services/dotnet_delegates_and_events.html

    ReplyDelete

My Blog List