Settings Is Readonly/ Changing Connection String?

Mar 2, 2006

This is regarding a windows app in Visual Studio 2005, a VB Windows application.'ve stored a connection string called strSQLConn in My.Settings. I'm trying to change the Server in code. I set a string variable called strConn to a new Connection string. My.Settings.Profile2006sql = strConn

This produces an error saying that My.Settings is readonly. I'm missing something basic here.

I don't know if this is the best way to change a connection string to toggle between a development server and a production server. My understanding is that if the setting Connection string is changed it will be used as the default for all the table adapters in a strongly typed dataset. Is that the case?

View 10 Replies


ADVERTISEMENT

Assign A My.Settings.Item Connection String To Cmd.Connection Connection String Value?

Aug 25, 2009

How do I assign a My.Settings.Item connection string to cmd.Connection connection string value?

Dim cmd As New SqlCommand()
cmd.Connection = My.Settings.Item("csStaffHoursWorked")
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spSaveDeltekImport"

View 3 Replies

Changing The Connection String?

Dec 15, 2011

I'm trying to change my connection string to w/e the user wants. After a few tips here and there, this is what I've come up:

1: In my settings I've added - Name(login), Type(String), Scope(User), Value(Nothing)

2: Here is the code I'm using

Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Here I'm checking if the login in my.settings is there
'If not, I'm going to let the user choose what database

[code]....

The error I get is: Format of the initialization string does not conform to specification starting at index 0.here -

Dim con As New OleDbConnection(My.Settings.login)

When I have my con equal to when I added the datasource from it works.

View 6 Replies

Get Rid Of Changing Connection String

Jan 18, 2012

im currently working on my thesis and i just wanna know how to avoid changing connectiong string? we are 4 members in a group each time that my other groupmate try to run our system in their own laptop/desktop they always change the server name. i wonder what if we implement our system in any computer? how were going to handle that?

View 1 Replies

Connection String In Application Settings

Jan 14, 2010

I'm trying to give my users the option to move their database to a different location, currently the datasource is set as an (Application Connection String) in the Project Settings, I know that when the scope is set to "Application" it cannot be modified but I'd like to know if there's a way for me to edit the location through code of my database in the application settings without crashing the program, can this be done? The purpose is to give whoever uses my application the freedom to choose where the database should be.

View 3 Replies

Changing Connection String In App.config?

Dec 31, 2010

For example i have form within the application which shows the connection string in a text box so the user can change it to there database but i cant work out how to save the new string to the connection string within the app.config file

View 1 Replies

Changing Connection String At Runtime Mode?

Mar 30, 2009

I have specified my connectionstring in My.Settings

But when I want to change it at runtime I get the error: Property connectionstring is read only.

Is it possible to change the connectionstring at runtime???

I used the following code:

[Code].....

View 1 Replies

Changing The Data Source For Connection String?

Mar 26, 2011

I developed a winform application and I want to send the .exe file to someone else. That means that my datasource for my connection string is not the same any more

Dim da As OleDbDataAdapter
Dim dt As New DataSet
Dim objConnection As OleDbConnection = New OleDb.OleDbConnection

[Code]....

View 3 Replies

Change Connection String Saved In My.Settings In Program?

Jan 30, 2012

I am writting an application and I used Wizard to create DataSets which auto-created their own xml code. This code uses the saved in My.Settings Connection String. Being a setting with an unchangable 'Application' scope i cannot change its value at runtime.

The problem is that when I install the Application to my customer the Connection String will have to change (maybe more than once). So is there a way to change the Connection String used by these objects at runtime ?

View 1 Replies

C# - Changing Connection String In DLL That Is Included In Executable Projects?

Nov 10, 2010

I have a project that is executable and I created a dll, which includes commonly used datasets among projects (DLLforApp and App). [DLLforApp]a separate project from App but in the same solution.this is a class library project which creates a dll file this has aconnection string which is LforApp.Properties.Settings.Default.ConnectionString[App]another project in the same solution.this project includes a reference for a set of datasets.. which is DLLforAppThis project also has a connection string which is the same as DLLforApp

View 2 Replies

Changing The Connection String Of LINQ Dmbl Programmaticaly?

Jun 2, 2009

I have two seperate databases, one is production the other is test. Before LINQ, I could simply change the connection string to swtich db's. However, the string is read only, and I have no way to change the string.

How can I change the Connection String programmatically?

Edited for Clarity

Im using my.settings to store all of this inforomation

View 2 Replies

Storing A Database Connection String Into Settings In A .net DLL Data Layer?

Mar 4, 2011

I've always used this approach while implementing data layer DLL for web application:

1) put datasets into the dll project
2) use a helper class with a method like this:

public shared sub settCnnStr(strconnhere as string)
My.Settings.Item("connectionString") = strconnhere
end sub

3) when I need to use the dll I call a method like this (usually into global.asax):

xxxxxxx.helper.setCnnStr("yyyyyyyyyyyyyy")

This method always worked for me nicely but I'd like to know if this method could have serious drawback or if there's a better solution.

View 1 Replies

VS 2008 - Store The Connection String In A Settings Table In The Database?

Apr 20, 2010

I am storing my connection string in my app.config file. I am using sql server express 2005. The connection string on my dev machine is different from the ones at the clients. so each time I update I open the config file and edit the connection string setting. This is quite a pain.also I have now published my app to an ftp folder so that the clients can get the updates each time I make changes. saves me the hassle of going to them each time i update. so now i need it to be so that I won't have to change the setting all the time.Would the best way be to store the connection string in a settings table in the database?

View 6 Replies

Changing A Connection String At Runtime For A Tableadapter That Was Created Using The Wizard?

Jun 21, 2010

I've created two forms of which two separate datasets/tableadapters were created by adding a datasource and dragging and dropping the fields onto my form.I was testing the program using a db that was located on my local drive. Well after publishing the app to the users machines, I noticed that the binded information was still being pulled from my local machine and not the database that the user is working off of.I've set the connection modifier properties for both tableadapters to Public, and I have written the following attempting to change the connection strings:

Private Sub btnSaveSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveSettings.Click
Dim pap As New frmPap
My.Settings.dbLocation = txtSettings.Text

[code]....

View 9 Replies

Changing Settings.settings Not Working

Apr 19, 2012

I can double click on the Setting.settings and the projects Settings grid appears in design. I change the value of a user scope setting yet when I run the application in debug it picks up a value I set initially instead of the current value of the setting.

When the app starts I set a connection string to the path of the .SDF file that I set in the Settings.settings grid and accesss it with

mRootSDFPath As
String =
My.Settings.SDFConnectionString

[Code].....

View 6 Replies

The Connection String Could Not Be Found Or Data Provider Associated With The Connection String Could Not Be Loaded

Mar 11, 2010

I got this Error Message while I try to preview the records in Dataset Designer:"The connection string could not be found or Data provider associated with the connection string could not be loaded"

Here is my dataset.xsd code

<Connections>
<Connection AppSettingsObjectName="MySettings" AppSettingsPropertyName="loginConnectionString1" IsAppSettingsProperty="true" Modifier="Assembly" Name="loginConnectionString1 (MySettings)"

[code]....

View 7 Replies

Changing Me.Settings Without Reload

Nov 2, 2011

I have a setting labeled "Names" and in the program I can create a new "Names" value, which works fine. But, I want to be able to automatically save to this new "Names" and retrieve information from the value without having to close the program and reopen it in order to have the new setting saved. Is there a way to do this? I tried using the Me.Refresh() command, but it didn't do the trick.

View 2 Replies

Changing Internet Proxy Settings?

Nov 25, 2009

How to do so in vb.net? In vb6 you do this [URL]... but then there is this as any and I wonder how to pass on the address of an object to the API also how to modify the program so we can put user authentication and password in VB using InternetSetOption

[Code]...

View 2 Replies

Changing Printer Preferences & Settings

Apr 2, 2010

I have to drive files using different settings from the printer driver. Can I change the preferences & settings of the driver from a VB application? Right now I am using a VBScript, using key presses, to drive the files. I am developing an application using VB.net. I want to get away from the key stroke method. It takes to long to drive all of the files at the different printer driver settings.

View 2 Replies

VS 2008 : Changing My.Settings Value During Runtime?

Sep 4, 2009

How do I change my code so that it will change the Value of the My.Settings.* to what TextBox1.Text is

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
My.Settings.Acc1 = TextBox1.Text And My.Settings.Pass1 = TextBox2.Text

[code]....

View 2 Replies

.net - Setting ReadOnly Property In PropertyGrid Sets All Properties Readonly?

Jun 12, 2012

I am using a PropertyGrid control to edit my class properties and I am trying to set certain properties read-only depending on other property settings.This is the code of my class:

Imports System.ComponentModel
Imports System.Reflection
Public Class PropertyClass[code].....

This is the code I am using to edit the values:

Dim c As New PropertyClass
PropertyGrid1.SelectedObject = c


The problem is that when I set SomeProperty to True, nothing happens and when I then set it to False again it sets all properties Read-Only.

View 1 Replies

XML App Settings For DB Connection?

Apr 7, 2011

It seems the code below for user ID and password is not used by my application, but I'm kinda confused at how my application is able to connect to the SQL server with only servername and dbname, because even if I remove the entry in the app.config for user ID and password, the application is still able to connect and return a data set. Can anyone explain how this happens?

[Code]...

View 4 Replies

Display Connection Properties Dialog For Connection String Browsing(for Database) In Run Time?

Feb 5, 2010

Is there a way to display the connection properties dialog for connection string browsing(for database) in run time?

As I want the user to be able to connect to various database using the GUI.

View 6 Replies

Connection Error When Using Project Settings

Feb 25, 2009

I get this error
Format of the initialization string does not conform to specification starting at index 34.
When I take my connection string and store it in the project settings. I know that this works.
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb

Because if I use it like this
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb")
conn.Open()

The connection succeeds but if I try this
Dim conn As New OleDbConnection(My.Settings.Default.employeeConnection)
conn.Open()

I get that error.
name:employeeConnection
type:string
scope:application
value:Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Employees.accdb

View 3 Replies

Winforms - .net Connection Entity Framework Connection String Security?

Sep 3, 2011

I understand the possibilities for encrypting a connection string in .net v4. I have a win forms application that will be used by multiple people on different machines. I understand that I need to protect the connection string at time of the app being first run on the target machine. However I am concerned that for a period of time my connection string will be unencrypted. I am looking for advice in how to deploy my app with the connection string already encrypted or encrypted during installation. encrypting the connection string in a secure way?

View 1 Replies

Safely Changing Database Connection?

Sep 29, 2011

I have a VS 2008 .NET application which connects to many tables within a SQL 2005 database in order to fill controls using multiple DataSets and TableAdapters.how to appropriately change the database connection within my Visual Studio .NET 2008 application in a manner that will provent having to modify the datasets and tableadapters. Will changing the connectionstring shown in the DataSet/TableAdapters properties render them unusable?The tables within the production database are identical to the tables in the development database.

View 5 Replies

IDE :: Missing Connection Strings In Application Settings

Nov 11, 2010

I am using VB 2008 & MS Access 2007 Databases for my Windows Forms Applications.The Problem is my Connection strings have been disappeared from DataSource Configuration Wizards & now i am unable to edit any Connection String in DataSet Designer.I had tried to create a Macro in MS Access Data File but didn't know how to create & so desided not to save any & just quit from Access and came back to Visual studio. Since then only this prob. has started. Earlier to this everything was just fine.I have tried to uninstall MS Office as well as Visual Studio then Re-installed Visual Studio but the problem is still there.

1] Error while trying to Reconfigure Data Adapter in Dataset

2] Disappeared options & Empty Connection Combo Box

3] Add Connection DialogBox with no DataSource property line in the Grid control

View 2 Replies

Invalid Connection String When Modifying Tableadapter Connection?

Jan 19, 2011

I'm developing an app in vb.net (visual studio 2008). I have a Teradata back-end that will be supporting multiple users in a production environment. I need to use variables in the connection string as the user/pass will be changed every 3 months.

For the gist of the application:

In it's most basic form - I have a search form which works correctly - it pulls results into a listbox and the user then double clicks the list box which will then open a form that is bound via table adapter to the back-end table (Teradata). My connection string is fine everywhere in the application. My problem is using a modified connection string for the "fill" function of the table adapter once the form is opened.

I'm using the code below for the on-load event and keep getting an "invalid connection string" - again, the connection string works fine everywhere else in the app, and the variables etc... are working correctly.

Private Sub adaptertest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DBConnStr As String = "Provider=TDOLEDB;Data Source=TDDEV;Persist Security

[Code].....

View 5 Replies

Mdb Connection - Transfer File Path In Our Connection String

Aug 26, 2009

I'm facing a problem after installation any software setup that has a database in access(mdb file) How to I transfer file path in our connection string.

View 3 Replies

DB/Reporting :: Changing Database While Connection Open?

May 17, 2010

I have a connection string in my app.config:

Code:
connectionString="data source=.sql2008 ;Database=Database1; Integrated Security=FALSE; Persist Security Info=True;" />

How do I change to another database (one of many) without using multiple strings? Can I change while the connection is open?

Code:
Dim myConn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString"))

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved