i'm wanting to connect to an Oracle database using the system.data.oracleClient provider and also allows users to be able to authenticate agaisnt the database by passing through textboxes on a login form their username and password..
i've created a AppConfig.config which looks like this
< xml version="1.0" encoding="utf-8" >
<configuration>
<connectionStrings>
<add name="partialConnectString"
providerName="System.Data.OracleClient"
connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=Cleopatre)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Jasp)));"
/>
</connectionStrings>
</configuration>
and i'm trying to retrieve this connectionstring using the following code but i'm getting a run-time error of type NullReferenceException unhandled [object reference not set an instance of an object] on the variable settings (which is of type ConnectionStringSettings )
here is the code
private static void BuildConnectionString( string username, string password)
{
// Retrieve the partial connection string named databaseConnection
// from the application's app.config or web.config file.
ConnectionStringSettings settings =
ConfigurationManager.ConnectionStrings["partialConnectString"];
// Retrieve the partial connection string.
string connectString = settings.ConnectionString;
MessageBox.Show("Original: {0}", connectString);
// Create a new oracleConnectionStringBuilder based on the
// partial connection string retrieved from the config file.
OracleConnectionStringBuilder builder =
new OracleConnectionStringBuilder(connectString);
// Supply the additional values.
builder.UserID = userName;
builder.Password = userPassword;
MessageBox.Show("Modified: {0}", builder.ConnectionString);
}
and of course the values passed in textboxes are going to map the values passed in the buildConnectionString
i just do not understand what to do!!!!
ok thanks in advance hope to hearing from you

Need help with my OracleconnectionStringBuilder
AlanKohl
Hi,
I worked with your code and with your config file and I did not got the error you mention - here you have a code snippet in Vb.net
Dim m_ConnStrs As ConnectionStringSettingsCollection = _ConfigurationManager.ConnectionStrings
For Each ConnSettings As ConnectionStringSettings In m_ConnStrscmdConnectionStrings.Items.Add(ConnSettings.Name)
NextIt worked until I tried to create an
OracleConnectionStringBuilder instance from that connection string like this
Dim m_ConnSettings As ConnectionStringSettings = _ConfigurationManager.ConnectionStrings(
"partialConnectString") Dim m_OraStr As New OracleConnectionStringBuilder(m_ConnSettings.ConnectionString) The problem I got is that a connection string max lenght must be 128 charactersInvalid length for connection option 'Data Source', maximum length is 128.
Best Regards