|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Oledb Connection String ?I have tried for an answer on another forum with no direct answer. I have my forms that have a connection to an Access db with all the connections created by the wizard. No problems with the operations of the forms in the design environment / machine. However, when I deploy the program I will not have control over the connection string. I have used Application.StartUpPath for the record source of the Crystal Reports but I want to use the same style for the connection.string. Can and how is this be done? Can I insert this function call in the connection string? For example: The current string: Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source="C:\Documents and Settings\Mark Gaeth\My Documents\Visual Studio Projects\My Model Railroad Empire\bin\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False Proposed String: Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=0;Data Source=Application.StartUpPath() & "\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False I am using VB.Net from VS2003. Thank you for any assistance you can throw my way. Mark Gaeth Decatur, IN Mark,
You can set your connectionstring at any moment before the open of a connection by oledbconnection.connectionstring = "blabla" When you use the designer don't than change any of your connectionstring code in that part, that can give problems when you are updating your program using the desinger. With this command above you just overwrite it. I hope this helps, Cor On Thu, 14 Apr 2005 10:24:30 GMT, "Mark Gaeth" <mga***@mchsi.com> wrote: ¤ Greetings,¤ ¤ I have tried for an answer on another forum with no direct answer. I have my ¤ forms that have a connection to an Access db with all the connections ¤ created by the wizard. No problems with the operations of the forms in the ¤ design environment / machine. However, when I deploy the program I will not ¤ have control over the connection string. I have used Application.StartUpPath ¤ for the record source of the Crystal Reports but I want to use the same ¤ style for the connection.string. Can and how is this be done? ¤ ¤ Can I insert this function call in the connection string? For example: ¤ ¤ The current string: ¤ Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet ¤ OLEDB:Database Locking Mode=0;Data Source="C:\Documents and Settings\Mark ¤ Gaeth\My Documents\Visual Studio Projects\My Model Railroad ¤ Empire\bin\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk ¤ Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System ¤ database=;Jet OLEDB:SFP=False;persist security info=False;Extended ¤ Properties=;Mode=Share Deny None;Jet OLEDB:Create System Database=False;Jet ¤ OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica ¤ Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False ¤ ¤ Proposed String: ¤ ¤ Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet ¤ OLEDB:Database Locking Mode=0;Data Source=Application.StartUpPath() & ¤ "\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk ¤ Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System ¤ database=;Jet OLEDB:SFP=False;persist security info=False;Extended ¤ Properties=;Mode=Share Deny None;Jet OLEDB:Create System Database=False;Jet ¤ OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica ¤ Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False ¤ I am using VB.Net from VS2003. Thank you for any assistance you can throw my ¤ way. As Cor mentioned to can set the ConnectionString property at run time. BTW, you may want to pair down your connection string a bit. Most of those parameters are not required unless they're being changed from their default values: ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0"; & _ "Data Source=" & Application.StartUpPath() & _ "\MyRRDBXP.mdb"; Paul ~~~~ Microsoft MVP (Visual Basic) Thanks for the tip. I did pare down the string and it did not crash in on
the design machine! Yippy-Skippy. I will try a deployment this weekend and see it if works on a neutral machine. Thanks again and will update as to the results after this weekend. Mark Show quoteHide quote "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message news:c51t51p16cuvc5pd10kn4suddsslo1jqui@4ax.com... > On Thu, 14 Apr 2005 10:24:30 GMT, "Mark Gaeth" <mga***@mchsi.com> wrote: > > ¤ Greetings, > ¤ > ¤ I have tried for an answer on another forum with no direct answer. I > have my > ¤ forms that have a connection to an Access db with all the connections > ¤ created by the wizard. No problems with the operations of the forms in > the > ¤ design environment / machine. However, when I deploy the program I will > not > ¤ have control over the connection string. I have used > Application.StartUpPath > ¤ for the record source of the Crystal Reports but I want to use the same > ¤ style for the connection.string. Can and how is this be done? > ¤ > ¤ Can I insert this function call in the connection string? For example: > ¤ > ¤ The current string: > ¤ Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet > ¤ OLEDB:Database Locking Mode=0;Data Source="C:\Documents and > Settings\Mark > ¤ Gaeth\My Documents\Visual Studio Projects\My Model Railroad > ¤ Empire\bin\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk > ¤ Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System > ¤ database=;Jet OLEDB:SFP=False;persist security info=False;Extended > ¤ Properties=;Mode=Share Deny None;Jet OLEDB:Create System > Database=False;Jet > ¤ OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without > Replica > ¤ Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False > ¤ > ¤ Proposed String: > ¤ > ¤ Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet > ¤ OLEDB:Database Locking Mode=0;Data Source=Application.StartUpPath() & > ¤ "\MyRRDBXP.mdb";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk > ¤ Transactions=1;Provider="Microsoft.Jet.OLEDB.4.0";Jet OLEDB:System > ¤ database=;Jet OLEDB:SFP=False;persist security info=False;Extended > ¤ Properties=;Mode=Share Deny None;Jet OLEDB:Create System > Database=False;Jet > ¤ OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without > Replica > ¤ Repair=False;User ID=Admin;Jet OLEDB:Encrypt Database=False > ¤ I am using VB.Net from VS2003. Thank you for any assistance you can > throw my > ¤ way. > > As Cor mentioned to can set the ConnectionString property at run time. > > BTW, you may want to pair down your connection string a bit. Most of those > parameters are not required unless they're being changed from their > default > values: > > ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0"; & _ > "Data Source=" & Application.StartUpPath() & _ > "\MyRRDBXP.mdb"; > > Paul > ~~~~ > Microsoft MVP (Visual Basic)
Other interesting topics
DataGrid -> DataTable mapping problem
Convertin dbnull to string How to look at parameter string disconnected typed dataset DataAdapter Update Does Nothing ADO error "There is already an open DataReader associated with this Connection" SQLHelper.ExecuteReader - Connection Close Oracle Data Providers (Connection Pooling & Transactions) Making my own strongly typed dataset Deleting from a dataview |
|||||||||||||||||||||||