Connectivity with SQL and VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raaz
    New Member
    • Sep 2007
    • 2

    #1

    Connectivity with SQL and VB

    How do I solve connectivity problem with SQL and VB?
    Please reply briefly with code
  • raaz
    New Member
    • Sep 2007
    • 2

    #2
    Originally posted by raaz
    How do I solve connectivity problem with SQL and VB?
    Please reply briefly with code
    What do I use for above this ADO or DAO and how?

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Kindly use the search box on the top right corner of your page.

      You will get a lot of them here.

      Comment

      • Jayachandra
        New Member
        • Mar 2007
        • 49

        #4
        Hi,

        Open a new project, Select Project---> References---> check the Active X Objects latest version.

        Then

        Declare connections, Recordsets etc...

        Example. for MS-Access(Assume that student name, address fields only in the table)

        form_load()

        Dim dbcon as adodb.connectio n
        Dim dbres as adodb.recordset
        Dim dbsql as string

        set dbcon=new adodb.connectio n

        with dbcon
        .CONNECTIONSTRI NG="PROVIDER=MI CROSOFT.Jet.ole db.4.0;data source=x:\Stude nt\studentlist. mdb" ' (space between data source)
        .open
        end with

        dbsql="select * from student"

        set dbres=new adodb.recordset

        dbres.open dbsql,dbcon,ado pendynamic,adlo ckbatchoptimist ic

        text1.text=dbre s.fields(0)
        text2.text=dbre s.fields(1)
        Last edited by Jayachandra; Sep 13 '07, 06:40 AM. Reason: Small Modification

        Comment

        • hariharanmca
          Top Contributor
          • Dec 2006
          • 1977

          #5
          Originally posted by raaz
          How do I solve connectivity problem with SQL and VB?
          Please reply briefly with code

          [CODE=vb]strSQLCONNECTIO N = "Provider=SQLOL EDB.1;Persist Security Info=False;User ID=strUserName; password=strPas sword;Initial Catalog=strInit ialCatalog;Data Source = strDataSourceNa me"[/CODE]

          I think this will help you.

          Comment

          Working...