|
-
Jan 14th, 2004, 03:40 PM
#1
Thread Starter
Frenzied Member
2 ?s - Dataset & IDE [Resolved]
1. If I create a dataset through Server Explorer, drag & drop rather than writing my own code, that has various bound textboxes, is the db connection automatically closed or do I have to close it in code? The reason I ask is that even after I closed the Solution in the IDE, the Access db on my desktop remained open until I closed the IDE itself. The only code I've added is:
VB Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
OleDbDataAdapter1.Fill(DataSet11)
OleDbConnection1.Close()
End Sub
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
Me.BindingContext(DataSet11, "PurpleSlips").Position() += 1
End Sub
2. The IDE's lost the ability to do things like automatically indent, highlight typos, etc. Intellisense works, and everything reformats after a build. I can't think of, or find, any settings to change that would do this. I installed J# yesterday, but that shouldn't affect VB. Is there a setting to fix for this?
Last edited by salvelinus; Jan 15th, 2004 at 09:25 AM.
-
Jan 14th, 2004, 05:31 PM
#2
Frenzied Member
The connection is automatically close for you. And the object will be destroyed when all references to the object go out of scope. Or you can just destroy the object yourself.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jan 14th, 2004, 06:23 PM
#3
Although if you are browsing the database or using a specific connection in the Server Explorer then the Server Explorer will leave the connection open until you either close the IDE or right click on the connection the Server Explorer and select Close Connection.
-
Jan 14th, 2004, 07:21 PM
#4
Thread Starter
Frenzied Member
That's what I'm doing, using a connection in Server Explorer. I was trying out different ways of connecting, followed the example in a book.
So even if I close the connection (e.g. oledbconnection1.close) in code, Server Explorer keeps it open? I'd have to create, open and close in code? That wouldn't happen in a deployed app, would it? The users don't have Server Explorer. I thought one of the big advantages of .Net was that there wasn't a constant connection to the db.
-
Jan 14th, 2004, 07:30 PM
#5
No the Server Explorer has its own connection that it uses only while you are viewing/browsing the data in the IDE/Server Explorer. This has nothing to do with the one it puts on your form except that they both use the same connection string. If you do not mess with the Server Explorer then it will not open that connection. Its a little confusing to explain but don't worry about it. Your app will be fine when deployed (providing you change the path if there is one in the connection string). I only mentioned it because if you are using Access you will see the lock file it creates when a database is in use. That will appear when using the Server Explorer until the IDE is closed or the connection in the Server Explorer and it is not caused by the application itself.
-
Jan 15th, 2004, 09:25 AM
#6
Thread Starter
Frenzied Member
Thanks both of you, that makes more sense. I did see the lock file and couldn't open the db separately, that's what got me worried.
And the IDE seems to be back to normal.
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
|