Results 1 to 6 of 6

Thread: MSDE and SQL Connection

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382

    MSDE and SQL Connection

    I have just installed the MSDE (free version) and coming from being an old AccessDB user, I'm a bit confused on just what I need to do in order to get things rolling.

    First off, I have created a new database in the data listing in the IDE.. I have added some tables..

    Now I need to figure out how to connect to my database in pure code. Does anyone have any good examples or locations of examples that would help me get on my way?

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    Thanks Pirate...

    A couple questions,

    What connection should I if all I'm doing is connecting to my database locally? Standard or Secured?

    Second, should the application be connectionless? In vb6 with access, I would establish a connection and keep it alive for the life of the application being open. But I read somewhere that the application should open a new connection , process the data then close the connection, is this true?

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    This is the simple form of SQL connection (locally) .
    Code:
    '"Standard Security:"
    
    "Data Source=YourComputerName;Initial Catalog=DatabaseName;User Id=sa;Password=asdasd;"
    Absolutely , I agree with closing the connection when you're done .New connection objects are added to the connection pool , this could slow things down , so why don't you create global connection object and use it along the way .

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Posts
    382
    so why don't you create global connection object and use it along the way .
    Ok cool.. Since my application is multithreaded, will a global connection object work? basically it's a online server using asyncronous sockets, so the possibility of the connection object being accessed at the same time is pretty good. Is the connection object multithreaded safe or would I need to take a different approach then?

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    From MSDN
    Thread Safety
    OleDbConnection

    Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.
    I've never done like this before , So I can't be sure of the answer .

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