|
-
Jul 23rd, 2003, 10:53 AM
#1
Thread Starter
Hyperactive Member
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"
-
Jul 23rd, 2003, 05:51 PM
#2
Sleep mode
Is this what you mean ?
VB Code:
Private MyPath As String =Application.StartupPath & "\YOURFILE.XXX"
Private MyPassword As String=Nothing
Private MyConnection As New OleDb.OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyPath & ";Jet OLEDB:Database Password=" & MyPassword)
-
Jul 24th, 2003, 07:13 AM
#3
Thread Starter
Hyperactive Member
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"
-
Jul 24th, 2003, 07:21 AM
#4
Sleep mode
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 ?
-
Jul 24th, 2003, 07:30 AM
#5
Thread Starter
Hyperactive Member
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
-
Jul 24th, 2003, 07:36 AM
#6
Sleep mode
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 ?
-
Jul 24th, 2003, 07:43 AM
#7
Thread Starter
Hyperactive Member
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
-
Jul 24th, 2003, 10:51 AM
#8
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|