|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
StringConnectionI would programatically choose between two Access Databases. They are both
the same structure. Only data change. How can I programatically say : "now, I change the database ?" I saw that the origin of the database is writen in an xsd file. By which property of which object can I programatically change the stringconnection to go from a database to another ? The reason is simple : to debug my program more quickly, I use a reduced database, but I would use another database in another directory (the original database is much greater) when I test the '.exe' release version of my program. If I can programatically change database, I can easily change the procedure to go from the first to the second. 'My.Settings.starDvdDataConnectionString' is ReadOnly. Thanks for your help Hi,
If you are using vb 2005 I would try the dbproviderfactory class http://www.vb-tips.com/default.aspx?ID=8c3dc2d7-1232-4dd1-817e-22eaaebb2723 Ken -------------------------- Show quoteHide quote "philip" wrote: > I would programatically choose between two Access Databases. They are both > the same structure. Only data change. > How can I programatically say : "now, I change the database ?" > I saw that the origin of the database is writen in an xsd file. By which > property of which object can I programatically change the stringconnection > to go from a database to another ? > > The reason is simple : to debug my program more quickly, I use a reduced > database, but I would use another database in another directory (the > original database is much greater) when I test the '.exe' release version of > my program. If I can programatically change database, I can easily change > the procedure to go from the first to the second. > > 'My.Settings.starDvdDataConnectionString' is ReadOnly. > > Thanks for your help > > > > I tried this address, but vb2005 don't recognize the object
'ConnectionStringSettings', even with 'Sytem.Configuration'. Must I add a special reference ? Thanks for your attention. Philip "Ken Tucker [MVP]" <KenTucker***@discussions.microsoft.com> a écrit dans le message de news: 6B7098E0-506A-4818-9CFA-2DD2DA9E9***@microsoft.com...Show quoteHide quote > Hi, > > If you are using vb 2005 I would try the dbproviderfactory class > > http://www.vb-tips.com/default.aspx?ID=8c3dc2d7-1232-4dd1-817e-22eaaebb2723 > > Ken > -------------------------- > > "philip" wrote: > >> I would programatically choose between two Access Databases. They are >> both >> the same structure. Only data change. >> How can I programatically say : "now, I change the database ?" >> I saw that the origin of the database is writen in an xsd file. By which >> property of which object can I programatically change the >> stringconnection >> to go from a database to another ? >> >> The reason is simple : to debug my program more quickly, I use a reduced >> database, but I would use another database in another directory (the >> original database is much greater) when I test the '.exe' release version >> of >> my program. If I can programatically change database, I can easily change >> the procedure to go from the first to the second. >> >> 'My.Settings.starDvdDataConnectionString' is ReadOnly. >> >> Thanks for your help >> >> >> >> Philip,
Be aware that you only need a very small part of this sample Did you see in top of it 'Set a reference to System.Configuration And did you do that. I hope this helps, Cor 'System.Configuration.ConnectionStringSettings' in not recognized, even with
'Imports System.Configuration' Error is "Type 'System.Configuration.ConnectionString' is not defined". Do you see why ? I use Visual Studio 2005 pro. Thanks for helping me. Philip "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl...Show quoteHide quote > Philip, > > Be aware that you only need a very small part of this sample > > Did you see in top of it > 'Set a reference to System.Configuration > > And did you do that. > > I hope this helps, > > Cor > Philip,
Import is only setting the shortcut for the namespace. A reference is set with (as I do it) Project (or Website) -> add reference -> choose the reference I hope this helps,, Cor Show quoteHide quote "philip" <p***@philippe.com> schreef in bericht news:441eb1cf$0$21274$8fcfb975@news.wanadoo.fr... > 'System.Configuration.ConnectionStringSettings' in not recognized, even > with 'Imports System.Configuration' > Error is "Type 'System.Configuration.ConnectionString' is not defined". > > Do you see why ? > > I use Visual Studio 2005 pro. > > Thanks for helping me. > > Philip > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de > news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl... >> Philip, >> >> Be aware that you only need a very small part of this sample >> >> Did you see in top of it >> 'Set a reference to System.Configuration >> >> And did you do that. >> >> I hope this helps, >> >> Cor >> > > Yes, I understood.
That works. Great thanks ! Philip "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: eDXmjUCTGHA.4***@TK2MSFTNGP14.phx.gbl...Show quoteHide quote > Philip, > > Import is only setting the shortcut for the namespace. > > A reference is set with (as I do it) > > Project (or Website) -> add reference -> choose the reference > > I hope this helps,, > > Cor > > > "philip" <p***@philippe.com> schreef in bericht > news:441eb1cf$0$21274$8fcfb975@news.wanadoo.fr... >> 'System.Configuration.ConnectionStringSettings' in not recognized, even >> with 'Imports System.Configuration' >> Error is "Type 'System.Configuration.ConnectionString' is not defined". >> >> Do you see why ? >> >> I use Visual Studio 2005 pro. >> >> Thanks for helping me. >> >> Philip >> >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl... >>> Philip, >>> >>> Be aware that you only need a very small part of this sample >>> >>> Did you see in top of it >>> 'Set a reference to System.Configuration >>> >>> And did you do that. >>> >>> I hope this helps, >>> >>> Cor >>> >> >> > > When I add my access Database to my project, VS2005 created a general
dataset with all the tables. It creates also a 'MyDataBaseConnectionString' for this dataset. All the hidden system use this string for the gestion of the connection between the general dataset and the database. With the example given by Ken Tucker, I understood how using 'ConnectiongStringSettings' to define a connection for a command. BUT my problem is to can modifiy the name of the database at the beginning of my program. 'My.Settings.MyDataBaseConnectionString' is ReadOnly. And I don't know how use 'ConnectiongStringSettings' to modify the general connection of my general dataset. Which property permits to define the connection string of a general dataset? In file 'MyDataBaseDataset.xsd', I see that hidden program use the 'MyDataBaseConnectionString'. How can I change the name of the database without touching the hidden code ? How can I use (and CAN I do it) the 'ConnectiongStringSettings' to modify my 'MyDataBaseConnectionString' Thanks for your help. "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: eDXmjUCTGHA.4***@TK2MSFTNGP14.phx.gbl...Show quoteHide quote > Philip, > > Import is only setting the shortcut for the namespace. > > A reference is set with (as I do it) > > Project (or Website) -> add reference -> choose the reference > > I hope this helps,, > > Cor > > > "philip" <p***@philippe.com> schreef in bericht > news:441eb1cf$0$21274$8fcfb975@news.wanadoo.fr... >> 'System.Configuration.ConnectionStringSettings' in not recognized, even >> with 'Imports System.Configuration' >> Error is "Type 'System.Configuration.ConnectionString' is not defined". >> >> Do you see why ? >> >> I use Visual Studio 2005 pro. >> >> Thanks for helping me. >> >> Philip >> >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl... >>> Philip, >>> >>> Be aware that you only need a very small part of this sample >>> >>> Did you see in top of it >>> 'Set a reference to System.Configuration >>> >>> And did you do that. >>> >>> I hope this helps, >>> >>> Cor >>> >> >> > > Philip,
Your connectionsstring is not hidden. It is in designer generated code normally in the app.config For most of us helping here is the problem that we have used the designer generated code in version 1.x only to try things. It was to confusing, I am in doubt if I will use it in 2.0 because that looks at least much better. If you cannot come further after this message. Can you than show us the piece of code where you fill the dataset. It comes than probably clearer for us, and than we can maybe help you better with that. Cor Show quoteHide quote "philip" <p***@philippe.com> schreef in bericht news:4421d4eb$0$29190$8fcfb975@news.wanadoo.fr... > When I add my access Database to my project, VS2005 created a general > dataset with all the tables. > It creates also a 'MyDataBaseConnectionString' for this dataset. > All the hidden system use this string for the gestion of the connection > between the general dataset and the database. > With the example given by Ken Tucker, I understood how using > 'ConnectiongStringSettings' to define a connection for a command. > > BUT my problem is to can modifiy the name of the database at the beginning > of my program. 'My.Settings.MyDataBaseConnectionString' is ReadOnly. > And I don't know how use 'ConnectiongStringSettings' to modify the general > connection of my general dataset. > Which property permits to define the connection string of a general > dataset? > In file 'MyDataBaseDataset.xsd', I see that hidden program use the > 'MyDataBaseConnectionString'. > How can I change the name of the database without touching the hidden code > ? > How can I use (and CAN I do it) the 'ConnectiongStringSettings' to modify > my 'MyDataBaseConnectionString' > > Thanks for your help. > > > > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de > news: eDXmjUCTGHA.4***@TK2MSFTNGP14.phx.gbl... >> Philip, >> >> Import is only setting the shortcut for the namespace. >> >> A reference is set with (as I do it) >> >> Project (or Website) -> add reference -> choose the reference >> >> I hope this helps,, >> >> Cor >> >> >> "philip" <p***@philippe.com> schreef in bericht >> news:441eb1cf$0$21274$8fcfb975@news.wanadoo.fr... >>> 'System.Configuration.ConnectionStringSettings' in not recognized, even >>> with 'Imports System.Configuration' >>> Error is "Type 'System.Configuration.ConnectionString' is not defined". >>> >>> Do you see why ? >>> >>> I use Visual Studio 2005 pro. >>> >>> Thanks for helping me. >>> >>> Philip >>> >>> >>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >>> de news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl... >>>> Philip, >>>> >>>> Be aware that you only need a very small part of this sample >>>> >>>> Did you see in top of it >>>> 'Set a reference to System.Configuration >>>> >>>> And did you do that. >>>> >>>> I hope this helps, >>>> >>>> Cor >>>> >>> >>> >> >> > > I solve the problem using a public String that I called ConnString.
And each time a TableAdapter must fill my datasets correponding to the tables on my Access Database I specify the connection like this : Dim Conn As New OleDb.OleDbConnection(ConnString) Me.MoviesTableAdapter.Connection = Conn Me.MoviesTableAdapter.Fill(Me.StarDvdDataDataSet.movies) So the program don't use the ConnectioinString created by itself in the Settings of the application. Thanks for your help "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message de news: eFe9hYkTGHA.1***@TK2MSFTNGP09.phx.gbl...Show quoteHide quote > Philip, > > Your connectionsstring is not hidden. It is in designer generated code > normally in the app.config > > For most of us helping here is the problem that we have used the designer > generated code in version 1.x only to try things. It was to confusing, I > am in doubt if I will use it in 2.0 because that looks at least much > better. > > If you cannot come further after this message. Can you than show us the > piece of code where you fill the dataset. It comes than probably clearer > for us, and than we can maybe help you better with that. > > Cor > > > "philip" <p***@philippe.com> schreef in bericht > news:4421d4eb$0$29190$8fcfb975@news.wanadoo.fr... >> When I add my access Database to my project, VS2005 created a general >> dataset with all the tables. >> It creates also a 'MyDataBaseConnectionString' for this dataset. >> All the hidden system use this string for the gestion of the connection >> between the general dataset and the database. >> With the example given by Ken Tucker, I understood how using >> 'ConnectiongStringSettings' to define a connection for a command. >> >> BUT my problem is to can modifiy the name of the database at the >> beginning of my program. 'My.Settings.MyDataBaseConnectionString' is >> ReadOnly. >> And I don't know how use 'ConnectiongStringSettings' to modify the >> general connection of my general dataset. >> Which property permits to define the connection string of a general >> dataset? >> In file 'MyDataBaseDataset.xsd', I see that hidden program use the >> 'MyDataBaseConnectionString'. >> How can I change the name of the database without touching the hidden >> code ? >> How can I use (and CAN I do it) the 'ConnectiongStringSettings' to modify >> my 'MyDataBaseConnectionString' >> >> Thanks for your help. >> >> >> >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >> de news: eDXmjUCTGHA.4***@TK2MSFTNGP14.phx.gbl... >>> Philip, >>> >>> Import is only setting the shortcut for the namespace. >>> >>> A reference is set with (as I do it) >>> >>> Project (or Website) -> add reference -> choose the reference >>> >>> I hope this helps,, >>> >>> Cor >>> >>> >>> "philip" <p***@philippe.com> schreef in bericht >>> news:441eb1cf$0$21274$8fcfb975@news.wanadoo.fr... >>>> 'System.Configuration.ConnectionStringSettings' in not recognized, even >>>> with 'Imports System.Configuration' >>>> Error is "Type 'System.Configuration.ConnectionString' is not defined". >>>> >>>> Do you see why ? >>>> >>>> I use Visual Studio 2005 pro. >>>> >>>> Thanks for helping me. >>>> >>>> Philip >>>> >>>> >>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> a écrit dans le message >>>> de news: OH3TqZ$SGHA.4***@TK2MSFTNGP14.phx.gbl... >>>>> Philip, >>>>> >>>>> Be aware that you only need a very small part of this sample >>>>> >>>>> Did you see in top of it >>>>> 'Set a reference to System.Configuration >>>>> >>>>> And did you do that. >>>>> >>>>> I hope this helps, >>>>> >>>>> Cor >>>>> >>>> >>>> >>> >>> >> >> > > |
|||||||||||||||||||||||