Help on dymanic installation
-
hello guys! I know this question might sound a litle stupid but this my first application and things are still confused for me.I'm developing a data centric application in VB.NET with Visual Studio 2005 that is supposed to connect to sql server installed on the machine or in the network. For exemple in my application project i use the data adapter to connect to the database X with my settings (i mean my user name and password of the sql server on my machine or integrated security) in the connection string on every windowsforms. Then i wanted a way to deploy my application that will create my database during the installation.I liked one of the msdn ways that use the installer class to read an sql file.But i was more interrested by the method used by Mukund PUJARI in his article "create a database during installation version 2".My anxiety is this:if the end user has the freedom to choose the database Y and his location, then my application will definitively not be connected to the database end since my connectionstring is different connection to a database X. In my point of there should be a method that can put in the connectionstring the data provided by the end user.I don't have any idea.Even though i knew and then using data adapters and datasets stuffs how can i make them use it?Supposing i kew it too,it would be then after deployement that i can test that my application is using the database name that i provided during installation. All this are confusing me and if somebody can just help it would make a programmer have a litle more knowledge thanks
eager to learn
-
hello guys! I know this question might sound a litle stupid but this my first application and things are still confused for me.I'm developing a data centric application in VB.NET with Visual Studio 2005 that is supposed to connect to sql server installed on the machine or in the network. For exemple in my application project i use the data adapter to connect to the database X with my settings (i mean my user name and password of the sql server on my machine or integrated security) in the connection string on every windowsforms. Then i wanted a way to deploy my application that will create my database during the installation.I liked one of the msdn ways that use the installer class to read an sql file.But i was more interrested by the method used by Mukund PUJARI in his article "create a database during installation version 2".My anxiety is this:if the end user has the freedom to choose the database Y and his location, then my application will definitively not be connected to the database end since my connectionstring is different connection to a database X. In my point of there should be a method that can put in the connectionstring the data provided by the end user.I don't have any idea.Even though i knew and then using data adapters and datasets stuffs how can i make them use it?Supposing i kew it too,it would be then after deployement that i can test that my application is using the database name that i provided during installation. All this are confusing me and if somebody can just help it would make a programmer have a litle more knowledge thanks
eager to learn
You can replace the name of the server, the database name, user name and password at runtime and update the connectionstring in config file. For example:
Driver={SQL Native Client};Server={0};Database={1};Uid={2};Pwd={3};
You can replace the string like that ~String.Format(Driver={SQL Native Client};Server={0};Database={1};Uid={2};Pwd={3}, txtServerName.Text, txtDatabaseName.Text, txtUserName.Text, txtPassword.Text)
then, you can update your config file if you want to.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
You can replace the name of the server, the database name, user name and password at runtime and update the connectionstring in config file. For example:
Driver={SQL Native Client};Server={0};Database={1};Uid={2};Pwd={3};
You can replace the string like that ~String.Format(Driver={SQL Native Client};Server={0};Database={1};Uid={2};Pwd={3}, txtServerName.Text, txtDatabaseName.Text, txtUserName.Text, txtPassword.Text)
then, you can update your config file if you want to.Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
hi michael thanks for giving so fast answera though i'm not sur i understood.Right now i don't know how to do such a thing, should it be in the installer class?In my architecture i have about 8 forms and 3 crystalreports and each of them has at least one data adapter.then i add an installer class that use a masterconnectionstring and then change the database master to the one provided by the end user in a user interface.The values entered is past to a variable in the overrided install method(if i'm not wrong).So it 'll read my sql text file to create all the object of this database.How should i implement what you just suggested? Thanks a lot.i went to michael.net not bad :-D
eager to learn