473,796 Members | 2,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect to the right SQL Server during runtime

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 ConnectionStrin g during application initialization
with the appropriate string that points to the customer's SQL Server,
but the ConnectionStrin g 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

Oct 8 '06 #1
1 1498
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:
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 ConnectionStrin g during application initialization
with the appropriate string that points to the customer's SQL Server,
but the ConnectionStrin g 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
Oct 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4612
by: Kona | last post by:
Hello, Is it right to tell that DB2 Connect has the same function that Oracle Net ? If I have an ODBC application is it also right to tell that I have 2 possibilities on my client workstation to acces a remote UDB database on a Sun machine : a) with a run-time client b) with DB2 Connect Personnal Edition Thank you
10
4377
by: Ed Stevens | last post by:
A tale of woe, and a question . . . Last week my boss said to me "we've installed DB2 Connect on this Solaris box. Make it work." Now, I've barely seen DB2 Connect on Windows, having fumbled thru one install and config, with a lot of handholding from IBM Support. I'm comfortable in unix but have never dealt with DB2 Connect there. (my main job is as an Oracle DBA, and most of my db's are on Solaris or AIX) I've found the install...
14
7043
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that sql server resides on is not reachable. The error is different depending on the connection string that I use. If I use the following connection string: "server=192.1.1.1; Initial Catalog=master; uid=The_User; password=The_Password; Connect...
5
2497
by: Nathan Sokalski | last post by:
I am attempting to send an email using ASP.NET 1.1's Mail.SmtpMail.Send() method. My code contains all of the following: Dim mailmsg As New Mail.MailMessage Mail.SmtpMail.SmtpServer = System.Configuration.ConfigurationSettings.AppSettings("smtpserver") mailmsg.BodyFormat = Mail.MailFormat.Text mailmsg.Subject = "My Subject"
0
3860
by: Neff | last post by:
I have a clustered installation of SQL Server 2005 with SSIS installed on the cluster. I'm running SQL Server Management Server on one of the cluster nodes and trying to connect to the integration services server. In the connection dialog the only editable field I have is server name and I can browse and find the server name SC-DB01. However wne I press the connect button I just get an error with the messages below...... Can anyone...
3
2760
by: LamSoft | last post by:
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server... Some of the Code.. protected void LoginButton_Click(object sender, EventArgs e) { if (Request.Form == null || Request.Form == "") { Session = "LocalHost"; }
14
11662
by: Khan | last post by:
Hello, I want to connect my intranet server (with php/apache) to the other informix database server, But I didnt it. I dont know how i can do it? Can i use php_informix extensions for example ifx_connect(); I was read this article: http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0606bombardier/index.html and doing step one step but i was not success.
3
2912
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_12\bin;.;C:\WINDOWS\System32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin;C:\Program...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.