Results 1 to 4 of 4

Thread: sql connection

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283

    sql connection

    i am trying to create a new sql connection

    Dim mySqlConnection As New SqlConnection(conString)

    what should be the value of conString if my database is C:\myDB.mdb (local)

    also, can you create a DataAdapter that is not specific to a single table in the DB?
    so that when I say

    myDataAdapter.Fill(myDataSet)

    it fills myDataSet with the entire DB, not just the single table designated by
    Dim DataAdapter As New SqlDataAdapter("SELECT * FROM myTable", conString)


    any answers?

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    sqlconnection is for sql server
    you need to use OleDbConnection object.


    here is a c# example,
    Code:
    public void openAccess2KDB()
    {
    	OleDbConnection conn = null;
    	string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + GlobalStuff.AccessDBPath;
    	conn = new OleDbConnection(strDSN);
    	conn.Open();
    }

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    and vb example..
    (NOT TESTED)
    Dim conn As New Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + GlobalStuff.AccessDBPath)
    conn.Open()

  4. #4
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    if u r using odbc
    then "data source = name"
    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width