Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO.NET 2

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
I'm having errors connecting to databases. However, while I'm using ASP.NET (.aspx), I'm trying to use ADO from original ASP. I'm very sure this is the problem.

What's the proper way to connect to a DB using ASP.NET? (connection String?) -Ovatvvon :-Q
 
Do you have to close the datareader or dataset's like you had to close the recordsets and connections in classic ado? -Ovatvvon :-Q
 
Ovat: From what I've read, if you're using VStudio, the records opened by the connection and dataset classes are closed automatically by the .NET platform (I wd assume this would be in most cases).
 
Coding the pages myself. Not using Visual Studio. -Ovatvvon :-Q
 
Nothing closes itself. You should still clean up after yourself.

We now have "garbage collection" that will clean up after us if we forget, but that will still affect performance of your site if you wait for it to do its thing.

penny1.gif
penny1.gif
 
Also still need to destroy the objects too after you close them?

conn.Close()
conn = Nothing

?? -Ovatvvon :-Q
 
Can't hurt. ;-)

Some objects have a .dispose method, which you should use when applicable. dataSet is one.

myDS.dispose()
penny1.gif
penny1.gif
 
does the datareader have the dispose() associated to it? -Ovatvvon :-Q
 
no. it has .close()

Don't take this the wrong way (you know I don't mind helping), but where is your documentation that came with the .NET SDK? It has full listings of all objects in there. Save yourself alot of time rather than waiting for someone to answer here.

:)
penny1.gif
penny1.gif
 
that's a good question. Guess I didn't realize there was documentation explaining it all...sounds like a good idea. lol

Guess it's this StartHere.htm file in my Microsoft.NET subfolders, huh?

Thanks for letting me know about it. Now I can get more complete lessons, and won't bother you all as much. :)

- Jim

p.s. Did you notice your post from above was deleted? -Ovatvvon :-Q
 
Yes... I made a typical me-mistake and just started typing w/o thinking. There were some glaring mis-statements in there, so I just red-flagged it. Your docs will have a better explanation of stuff, anyway.

If you go to the .NET program group on your start menu, there's an option in there called "documentation" with the little blue dot next to it. That's what I was referring to. Very easy to navigate... use the index to search on objects, and normally what you're going to be after is "all members" under the object heading. Very close to a "devguru" type listing of properties and methods, albeit w/o the great examples.
penny1.gif
penny1.gif
 
Thanks for the advice. With the connection object in Studio.NET I believe the function is a follows...

.......
DsGrpSummary.Clear()
OleDbDataAdapter1.Fill(DsGrpSummary)
DataGrid1.DataBind()
'cleaning up...
OleDbConnection1.Close()
OleDbConnection.ReleaseObjectPool()

...this ending, which I haven't been using until now, does not affect the program from what I can see so I suppose it's doing its job...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top