DB location string + SQL qweries
-
Hello, I'm building a little VB.NET application who will connect to an Access DB to fill its fields. I would like to know two things to build my architecture in the right path. 1- Is it a good idea to store the databse location in a registry key (Microsoft.Win32.Registry.CurrentUser)? If not, where should I store it? 2- To access tables in the database, I plan to create, lets say, an SQLAgent class (a layer) between my application and the DB to do any transactions (SELECT, UPDATE, DELETE, ...). This SQLAgent could run any SQL qwery passed in parameter. The constructor of this SQLAgent class would receive the DB location string to open the DB. Then this SQLAgent object, once created, would receive the SQL qwery to run and return the current recordset. When this transaction is done, this SQLAgent object can be deleted (finalized). And the VB form can fill its fields with the content of the recordset. So every forms would have control over its own SQL string and call SQLAgent whenever it need it. My point is, am I right with #1 and #2? Thank you very much, I am used with OO but it is the first time I plan to access to DB and I want to do it the right way. Because this is a personal project but I want my code to be reusable, so best practice is the best. Xelk
-
Hello, I'm building a little VB.NET application who will connect to an Access DB to fill its fields. I would like to know two things to build my architecture in the right path. 1- Is it a good idea to store the databse location in a registry key (Microsoft.Win32.Registry.CurrentUser)? If not, where should I store it? 2- To access tables in the database, I plan to create, lets say, an SQLAgent class (a layer) between my application and the DB to do any transactions (SELECT, UPDATE, DELETE, ...). This SQLAgent could run any SQL qwery passed in parameter. The constructor of this SQLAgent class would receive the DB location string to open the DB. Then this SQLAgent object, once created, would receive the SQL qwery to run and return the current recordset. When this transaction is done, this SQLAgent object can be deleted (finalized). And the VB form can fill its fields with the content of the recordset. So every forms would have control over its own SQL string and call SQLAgent whenever it need it. My point is, am I right with #1 and #2? Thank you very much, I am used with OO but it is the first time I plan to access to DB and I want to do it the right way. Because this is a personal project but I want my code to be reusable, so best practice is the best. Xelk
Hi Xelk: VB.NET facilitates .EXE.COnfig. Is'nt it? You can have the connectionstrings with ScringScrambling or some small-scale reversible encryption and store it there. What do you say? Deepak Kumar Vasudevan Personal Web: http://deepak.portland.co.uk/ I Blog At: http://deepak.blogdrive.com/
-
Hi Xelk: VB.NET facilitates .EXE.COnfig. Is'nt it? You can have the connectionstrings with ScringScrambling or some small-scale reversible encryption and store it there. What do you say? Deepak Kumar Vasudevan Personal Web: http://deepak.portland.co.uk/ I Blog At: http://deepak.blogdrive.com/
-
Very good idea Deepak, Is this file editable when the package is compiled then deployed? What do you think of my point #2? Thank you Xelk
Hi Xelk: The .EXE.Config file is a kind of plain XML file. You can read it via ConfigurationSettings.AppSettings["keyname"] in your application. Whatever is there in the Config File for the particular keyname after modifying it, post package and deployment also, would be taken. Did this attend to your query? Deepak Kumar Vasudevan Personal Web: http://www24.brinkster.com/lavanyadeepak/default.asp I Blog At: http://deepak.blogdrive.com/
-
Hi Xelk: The .EXE.Config file is a kind of plain XML file. You can read it via ConfigurationSettings.AppSettings["keyname"] in your application. Whatever is there in the Config File for the particular keyname after modifying it, post package and deployment also, would be taken. Did this attend to your query? Deepak Kumar Vasudevan Personal Web: http://www24.brinkster.com/lavanyadeepak/default.asp I Blog At: http://deepak.blogdrive.com/