Simple question... I hope.
I have a local database, in this case, SQLite that has been bound to a dataviewgrid. All works fine in this case.
My question is: How do I migrate this solution to more of a code based solution. My finished project will have user specific databases.
So the database schema will be the same as the current local database, the only thing that will change is the location of the database which I intend to put in the users appdata area.
So, I believe the only thing I need to do, is change the connection and this is where I run into questions. The connection string seems to be stored in the settings file and this value is read only.
What I have done to this point, is create a new connection to my desired location and then have set the tableadapter.connection with this connection in the initialize method of my class. This just doesn't seem very scalable.
Can anyone recommend a best practice for doing this?
Loading
Amit ChoudharyPosted Dec 8, 2009, 12:31 AM
if you are on windows application then create the method for it if it is an action and if holds simply a value then create a property...
but if you are on web application then i becomes little bit different in case of properties as on page refresh every variable value gone.. so you have to create view state preserved properties and it may remain as long as you session timed out.....
if it is your answer then please mark it..
Glenn WelkerPosted Dec 7, 2009, 10:26 AM
My concern is that I am using a lot of Visual Studio magic to create all of the objects and bindings through the GUI. Then, later at runtime I would like to keep essentially everything except for the database connection. Ideally, I could just delete the current connection and create a class or property to hold my connection that I would define in code.
I worry that setting my connection at the beginning of my connection class isn't the correct way to set the connection.
How long will the connection stay active?
Should I put the connection in a property or method?
If so, where?
...
patrickPosted Dec 7, 2009, 10:15 AM
patrickPosted Dec 7, 2009, 10:14 AM