I am facing the error at "GetConnectionInfo"
Private string GetConnectionInfo(string ConName)
{
string PKey;
PKey = GetKeyInfo();
System.Data.OleDb.OleDbDataReader rs;
System.Data.OleDb.OleDbConnection oCon = new System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand oComm = new System.Data.OleDb.OleDbCommand();
string sSql;
string ConfConnection;
try
{
ConfConnection = Dts.Connections("Config").ConnectionString.ToString();
oCon.ConnectionString = ConfConnection;
oCon.Open();
sSql = "SELECT [CNCTN_NM],[USER_ID],[PSWRD_TXT],[DATA_SRC_NM],[CATLG_NM],[PRVDR_NM], [INTEGRATED_SECURITY] FROM [TDW_ETL_CONNECTSTRING] WHERE [CNCTN_NM] = '" + ConName + "'";
oComm.CommandText = sSql;
oComm.Connection = oCon;
oComm.CommandTimeout = 600;
rs = oComm.ExecuteReader();
string CNCTN_NM;
string USER_ID;
string PSWRD_TXT;
string dUSER_ID;
string dPSWRD_TXT;
string DATA_SRC_NM;
string CATLG_NM;
string PRVDR_NM;
bool INTEGRATED_SECURITY;
while (rs.Read())
{
// Get The Data from the table
CNCTN_NM = System.Convert.ToString(rs.GetValue(0));
if (rs.IsDBNull(1) == false)
USER_ID = System.Convert.ToString(rs.GetValue(1));
if (rs.IsDBNull(2) == false)
PSWRD_TXT = System.Convert.ToString(rs.GetValue(2));
DATA_SRC_NM = System.Convert.ToString(rs.GetValue(3));
CATLG_NM = System.Convert.ToString(rs.GetValue(4));
PRVDR_NM = System.Convert.ToString(rs.GetValue(5));
INTEGRATED_SECURITY = System.Convert.ToBoolean(rs.GetBoolean(6));
// Decrypt the userid and password
if (INTEGRATED_SECURITY == false)
{
dUSER_ID = DecryptTripleDES(USER_ID, PKey);
dPSWRD_TXT = DecryptTripleDES(PSWRD_TXT, PKey);
}
}
我在这里遇到错误====>
GetConnectionInfo = GenerateConnectionString(PRVDR_NM, dUSER_ID, dPSWRD_TXT, INTEGRATED_SECURITY, DATA_SRC_NM, CATLG_NM);
}
finally
{
if (!rs.IsClosed)
rs.Close();
oComm.Dispose();
oCon.Dispose();
}
}
答案 0 :(得分:0)
您正在尝试为方法分配值。这是不可能的。 我认为您想要达到的目标可能是:
string connectionInfo = GetConnectionInfo(GenerateConnectionString(PRVDR_NM, dUSER_ID, dPSWRD_TXT, INTEGRATED_SECURITY, DATA_SRC_NM, CATLG_NM));