You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.6 KiB
71 lines
2.6 KiB
using edoka_dms;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data.SqlTypes;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace edoka_dms
|
|
{
|
|
public class clsMyKey_Tabelle : edoka_dms.clsKey_tabelle
|
|
{
|
|
public string connectionstring = "";
|
|
public string get_dbkey(string Tablename)
|
|
{
|
|
string m_dbkey = "";
|
|
SqlCommand scmCmdToExecute = new SqlCommand();
|
|
scmCmdToExecute.CommandText = "dbo.[sp_get_dbkey]";
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure;
|
|
scmCmdToExecute.Connection = m_scoMainConnection;
|
|
scmCmdToExecute.Connection.ConnectionString = connectionstring;
|
|
try
|
|
{
|
|
scmCmdToExecute.Parameters.Add(new SqlParameter("@Tablename", SqlDbType.VarChar, 255, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, Tablename));
|
|
scmCmdToExecute.Parameters.Add(new SqlParameter("@dbkey", SqlDbType.Int, 4, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, m_dbkey));
|
|
scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, true, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode));
|
|
if (m_bMainConnectionIsCreatedLocal)
|
|
{
|
|
m_scoMainConnection.Open();
|
|
}
|
|
else
|
|
{
|
|
if (m_cpMainConnectionProvider.bIsTransactionPending)
|
|
{
|
|
scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction;
|
|
}
|
|
}
|
|
try
|
|
{
|
|
scmCmdToExecute.Connection.Open();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
finally
|
|
{
|
|
}
|
|
scmCmdToExecute.ExecuteNonQuery();
|
|
m_dbkey =scmCmdToExecute.Parameters[1].Value.ToString();
|
|
scmCmdToExecute.Connection.Close();
|
|
return m_dbkey;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("clsKey_tabelle::get_dbkey::Error occured." + ex.Message, ex);
|
|
}
|
|
finally
|
|
{
|
|
if (m_bMainConnectionIsCreatedLocal)
|
|
{
|
|
m_scoMainConnection.Close();
|
|
}
|
|
scmCmdToExecute.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|