update 20250226
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -124,6 +124,74 @@ namespace Database
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public DataTable Get_Tabledata_Addvar(string Tablename, bool StoredProc = false, bool is_SQL_String = false, DataTable sp_params = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
Logging.Logging.Debug("", "EDOKA_DB:Get_Tabledata Start:" + Tablename, "");
|
||||
if (sp_params == null && SP_Parameters.Rows.Count > 0)
|
||||
{
|
||||
sp_params = SP_Parameters.Copy();
|
||||
}
|
||||
|
||||
SqlConnection sqlconnect = new SqlConnection();
|
||||
DataSet ds = new DataSet();
|
||||
ds.Tables.Clear();
|
||||
dsdaten.Tables.Clear();
|
||||
|
||||
|
||||
sqlconnect.ConnectionString = connectionstring;
|
||||
SqlDataAdapter da = new SqlDataAdapter("", sqlconnect);
|
||||
SqlCommand sqlcmd = new SqlCommand();
|
||||
sqlcmd.Connection = sqlconnect;
|
||||
|
||||
|
||||
|
||||
if (StoredProc == true)
|
||||
|
||||
{
|
||||
sqlcmd.CommandType = CommandType.StoredProcedure;
|
||||
if (Tablename.IndexOf("@@Mandantnr@@") > 0)
|
||||
Tablename = Tablename.Replace("@@Mandantnr@@", "");
|
||||
sqlcmd.CommandText = Tablename;
|
||||
try
|
||||
{
|
||||
foreach (DataRow r in sp_params.Rows)
|
||||
{
|
||||
sqlcmd.Parameters.Add(r["Paramname"].ToString(), SqlDbType.VarChar);
|
||||
sqlcmd.Parameters[sqlcmd.Parameters.Count - 1].Value = r["Paramvalue"].ToString();
|
||||
}
|
||||
}
|
||||
catch { };
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlcmd.CommandType = CommandType.Text;
|
||||
sqlcmd.CommandText = "Select * from " + Tablename;
|
||||
}
|
||||
if (is_SQL_String == true) {
|
||||
sqlcmd.CommandText = Tablename;
|
||||
foreach (DataRow r in sp_params.Rows)
|
||||
{
|
||||
sqlcmd.Parameters.AddWithValue(r["Paramname"].ToString(), r["Paramvalue"].ToString());
|
||||
}
|
||||
}
|
||||
da.SelectCommand = sqlcmd;
|
||||
sqlconnect.Open();
|
||||
da.Fill(dsdaten, "Daten1");
|
||||
sqlconnect.Close();
|
||||
Logging.Logging.Debug("", "EDOKA_DB:Get_Tabledata:" + Tablename, "");
|
||||
return dsdaten.Tables[0];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Logging.Logging.Error(ex.Message, "EDOKA_DB:Get_Tabledata:" + Tablename, "");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public void Exec_SQL(string sql)
|
||||
{
|
||||
SqlConnection sqlconnect = new SqlConnection();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user