G
Guest
Hello,
Currently, I'm using Visual Studio 2003, C#, Framework 1.1 and Enterprise
Library 2005 (for framework 1.1).
I've used the Enterprise Library Configuration utility to create my
connection to SQL Server, however when I run my C# program that calls a
Stored Procedure it fails. Here is what the ConnectionString block looks
like in my dataConfiguration.config file.
<connectionString name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="false"
/>
<parameter name="initial catalog" value="MyDB"
isSensitive="false" />
<parameter name="persist security info" value="False"
isSensitive="false" />
<parameter name="uid" value="userid" isSensitive="true" />
<parameter name="packet size" value="4096" isSensitive="false" />
<parameter name="pwd" value="password" isSensitive="true" />
</parameters>
</connectionString>
I noticed that when the Enterprise Library reads the
dataConfiguration.config file it looks for "uid" & "pwd", and strips it out,
so then my connection fails because it doesn't have the correct credentials.
Can anyone tell me why I am can't connect to my DB? Is there another step I
need to take in my C# program to make the connection? Here's what the code
looks like:
Database db = DatabaseFactory.CreateDatabase("SQL Server");
string sqlCommand = "autoApInput_getFile";
DBCommandWrapper dbCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand);
// Add paramters
// Input parameters can specify the input value
dbCommandWrapper.AddInParameter("@visitor", DbType.Int32, 1);
dbCommandWrapper.AddInParameter("@po", DbType.String, "0018487402");
dbCommandWrapper.AddInParameter("@poAmount", DbType.String, "$156.25");
db.ExecuteNonQuery(dbCommandWrapper);
Thanks,
Currently, I'm using Visual Studio 2003, C#, Framework 1.1 and Enterprise
Library 2005 (for framework 1.1).
I've used the Enterprise Library Configuration utility to create my
connection to SQL Server, however when I run my C# program that calls a
Stored Procedure it fails. Here is what the ConnectionString block looks
like in my dataConfiguration.config file.
<connectionString name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="false"
/>
<parameter name="initial catalog" value="MyDB"
isSensitive="false" />
<parameter name="persist security info" value="False"
isSensitive="false" />
<parameter name="uid" value="userid" isSensitive="true" />
<parameter name="packet size" value="4096" isSensitive="false" />
<parameter name="pwd" value="password" isSensitive="true" />
</parameters>
</connectionString>
I noticed that when the Enterprise Library reads the
dataConfiguration.config file it looks for "uid" & "pwd", and strips it out,
so then my connection fails because it doesn't have the correct credentials.
Can anyone tell me why I am can't connect to my DB? Is there another step I
need to take in my C# program to make the connection? Here's what the code
looks like:
Database db = DatabaseFactory.CreateDatabase("SQL Server");
string sqlCommand = "autoApInput_getFile";
DBCommandWrapper dbCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand);
// Add paramters
// Input parameters can specify the input value
dbCommandWrapper.AddInParameter("@visitor", DbType.Int32, 1);
dbCommandWrapper.AddInParameter("@po", DbType.String, "0018487402");
dbCommandWrapper.AddInParameter("@poAmount", DbType.String, "$156.25");
db.ExecuteNonQuery(dbCommandWrapper);
Thanks,