|
-
May 22nd, 2004, 12:02 AM
#1
Thread Starter
Hyperactive Member
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?
-
May 22nd, 2004, 01:06 AM
#2
Sleep mode
-
May 22nd, 2004, 03:04 AM
#3
Thread Starter
Hyperactive Member
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?
-
May 22nd, 2004, 03:23 AM
#4
Sleep mode
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 .
-
May 22nd, 2004, 03:55 AM
#5
Thread Starter
Hyperactive Member
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?
-
May 22nd, 2004, 08:46 AM
#6
Sleep mode
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|