Results 1 to 6 of 6

Thread: 2 ?s - Dataset & IDE [Resolved]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         OleDbDataAdapter1.Fill(DataSet11)
    3.         OleDbConnection1.Close()
    4.     End Sub
    5.  
    6.     Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
    7.         Me.BindingContext(DataSet11, "PurpleSlips").Position() += 1
    8.     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.

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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
  •  



Click Here to Expand Forum to Full Width