|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connect to the right SQL Server during runtimeI am new to VB.NET and would like to get some help. I have a VB.NET Windows application that connects to my development SQLServer during development. I use the VS 2005 designer to create the DataSet (via Add Data Connection) that points to my development SQL Server and drag the fields and drop them to my forms and reports. The problem I have is that the application cannot be deployed since the code always points back to my development SQL Server. I tried changing the ConnectionString during application initialization with the appropriate string that points to the customer's SQL Server, but the ConnectionString in the My.Settings has Application scope (read-only), not User scope (read-write). I would like to stay away from having to supply app.config file. Another thing I tried is to create another SqlConnection object with the correct connection string (server name, etc.) and replace the SqlConnection object during application initialization. That does not work either because the SqlConnection object that is created in the wizard-generated code is private. I hate to modify the wizard-generated code since there is a strong warning on the top that says "Do not modify". I would like to know if there is a way to do one of the following from within the application that I am not aware of: (1) Modify the connection string. (2) Make the wizard-generated code use the SqlConnection object that I create during initialization with the correct connection string. If the answers to both are 'no', what other ways can I solve this problem? It appears that using wizard (designer) is not the right way to develop applications that can be deployed to customers, even though it helps you quite a bit during design with it's drag and drop ease onto the forms and reports. What do you think? I appreciate any help I can get. Thanks in advance. Ken Personally, I don't use the wizard so I can't really help you on how to
use it to edit the connection string and other settings. However, you shouldn't be afraid to edit the generated code, just back it up first so if you accidently ruin something you can just restore it. Editing the code itself will also teach you more about the language than just using a wizard. If you need any help changing the generated code please post back and I will try to help you out. Thanks, Seth Rowe Ken Jones wrote: Show quoteHide quote > Hi all, > > I am new to VB.NET and would like to get some help. > > I have a VB.NET Windows application that connects to my development > SQLServer during development. I use the VS 2005 designer to create the > DataSet (via Add Data Connection) that points to my development SQL > Server and drag the fields and drop them to my forms and reports. > > The problem I have is that the application cannot be deployed since the > code always points back to my development SQL Server. > > I tried changing the ConnectionString during application initialization > with the appropriate string that points to the customer's SQL Server, > but the ConnectionString in the My.Settings has Application scope > (read-only), not User scope (read-write). I would like to stay away > from having to supply app.config file. > > Another thing I tried is to create another SqlConnection object with > the correct connection string (server name, etc.) and replace the > SqlConnection object during application initialization. That does not > work either because the SqlConnection object that is created in the > wizard-generated code is private. I hate to modify the wizard-generated > code since there is a strong warning on the top that says "Do not > modify". > > I would like to know if there is a way to do one of the following from > within the application that I am not aware of: > (1) Modify the connection string. > (2) Make the wizard-generated code use the SqlConnection object > that I create during initialization with the correct connection string. > > If the answers to both are 'no', what other ways can I solve this > problem? > > It appears that using wizard (designer) is not the right way to develop > applications that can be deployed to customers, even though it helps > you quite a bit during design with it's drag and drop ease onto the > forms and reports. What do you think? > > I appreciate any help I can get. > > Thanks in advance. > Ken
Experience Request: GPS Application
How to prevent Pasting into textbox? What is the optimal way to upload 10,000 records to Oracle DB? Multi-dimensional array - Question on Data types How do I replace unwanted characters from a string using Reg Exp? Memory problem with vb.net + webServices + DLL Tab groups in VB2003 debugging How can I get the data type of a data table's columns? uncleared code ASP.Net 2.0 programmatically forcing page re-load from the server |
|||||||||||||||||||||||