connect VB with SQL Server !!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dere
    New Member
    • Aug 2007
    • 1

    connect VB with SQL Server !!

    show me how to connect visual basic with sequential query language server.
  • fplesco
    New Member
    • Jul 2007
    • 82

    #2
    Originally posted by dere
    show me how to connect visual basic with sequential query language server.
    Here try this.

    I hope you know how to create a connectionstrin g....(",)
    Or in place of ConnectionStrin g, you can use DSN Name.
    Code:
    Public Con,Rs 
    Public Function dbConnect(strQuery as string) 
        set Con = CreateObject("ADODB.Connection")
        Con.ConnectionString = "<your connectionstring>" 
        Con.Open
        set Rs = CreateObject("ADODB.Recordset")
        Rs.ActiveConnection = Con
        Rs.Open StrQuery
    End Function
    Then, you can manipulate Rs object in your forms after calling it and passing an SQL query paramater coz its global recordset ADO object.

    Comment

    Working...