Initial Comit
This commit is contained in:
70
Database/DB/clsMyKey_Tabelle.cs
Normal file
70
Database/DB/clsMyKey_Tabelle.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user