Results 1 to 8 of 8

Thread: How to avoid having to refresh my Database connection every Time.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    How to avoid having to refresh my Database connection every Time.

    How to avoid having to refresh my Database connection every Time.

    This is the code generated by Windows.

    It seems like every time I change the folders name I need to refresh my Database connection, how can I avoid this how Can I change this code to have the program always look in the applications folders named DATA rigth on the application's path?

    Code:
    OleDbConnection1
    
    Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
    
    "ocking Mode=1;Data Source=""C:\Documents and Settings\Telemetrika.Com\My Document" & _
    
    "s\Zanussi Brio 250 Software\Data\BrioDatabase v1.3.mdb"";Mode=Share Deny None;Jet" & _
    
    " OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System databas" & _
    
    "e=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLED" & _
    
    "B:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLED" & _
    
    "B:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User" & _
    
    " ID=Admin;Jet OLEDB:Global Bulk Transactions=1"

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Is this what you mean ?
    VB Code:
    1. Private MyPath As String =Application.StartupPath & "\YOURFILE.XXX"
    2. Private MyPassword As String=Nothing
    3. Private MyConnection As New OleDb.OleDbConnection
    4. ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyPath & ";Jet OLEDB:Database Password=" & MyPassword)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376
    Pirate:

    The question is whether I could change the code in this section “#Region " Windows Form Designer generated code ".

    The goal is to change the code in a way that the BrioDatabase v1.3.mdb database is always found in the DATA folder on the Application Path.

    How do you suggest I do the changes in the “#Region " Windows Form Designer generated code " itself or outside it?

    Could you please give me an idea.





    on this section:
    Code:
    #Region " Windows Form Designer generated code "
    This code is found:
    Code:
            'OleDbConnection1
            '
            Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
            "ocking Mode=1;Data Source=""C:\Documents and Settings\Telemetrika.Com\My Document" & _
            "s\Zanussi Brio 250 Software\Data\BrioDatabase v1.3.mdb"";Mode=Share Deny None;Jet" & _
            " OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System databas" & _
            "e=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLED" & _
            "B:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLED" & _
            "B:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User" & _
            " ID=Admin;Jet OLEDB:Global Bulk Transactions=1"

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I think you can change it . The " #Region " Windows ...." is nothing more than a form Class like any class . But why do you want to change it ?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376
    Pirate:

    I want to change the code to have the program always look in the applications folder, named DATA, rigth on the same application's path?

    I want to change it to avoid having to refresh my Database connection every Time I change the application's folders name.

    What do you suggest I do?

    Andy

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Use OpenDialogForm and let the user pick the database file . My question still apply , why do you need to change the folder or the path ?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376
    Pirate:


    I wont complicate my life anymore I'll use OpenDialogForm and let the user pick the database file.

    Thanks pal you been great!!!

    Andy

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376
    Pirate:


    Could you answer this question for me?

    Why does the label " lblNavLocation " for the record count does not update when I click a Row directly on the datagrid?



    code:--------------------------------------------------------------------------------Private Sub objdsMachines_PositionChanged()
    Me.lblNavMachinesLocation.Text = (((Me.BindingContext(dataSetMachines, "Machines").Position + 1).ToString + " of ") _
    + Me.BindingContext(dataSetMachines, "Machines").Count.ToString)
    End Sub
    --------------------------------------------------------------------------------


    But when I click a Navigation Bar buttons like Next or Previous then it does.

    code:--------------------------------------------------------------------------------Private Sub btnNextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNextRecord.Click
    Me.BindingContext(dataSetReadings, "Readings").Position = (Me.BindingContext(dataSetReadings, "Readings").Position + 1)
    Me.objdsReadings_PositionChanged()
    End Sub

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