public OracleCommand cmd = null;
public OracleConnection conn = null;
private WriteData LA = new WriteData();
public bool insertValues(string TableName, string[] ColumnName, Type[] ColumnType, object[] ColumnValues)
{
bool flag = false;
try
{
this.conn.Open();
if ((ColumnName.Length == ColumnType.Length) && (ColumnName.Length == ColumnValues.Length))
{
string strCmd = "Insert Into" + TableName + "(";
for (int i = 0; i < ColumnName.Length; i++)
{
strCmd += ColumnName[i] + ",";
}
strCmd = strCmd.Remove(strCmd.Length - 1, 1);
strCmd += ") Values (";
for (int i = 0; i < ColumnType.Length; i++)
{
strCmd += "'" + ColumnValues[i].ToString() + "',";
strCmd += ColumnValues[i].ToString() + ",";
strCmd = strCmd.Remove(strCmd.Length - 1, 1) + ")";
}
cmd = new OracleCommand(strCmd, conn);
if (cmd.ExecuteNonQuery() != 0)
{
flag = true;
}
else
{
flag = false;
}
}
else
{
throw new Exception("Number of Arguments do not match");
}
}
catch (Exception exception)
{
this.LA.WriteLine(exception.Message);
}
finally
{
this.conn.Close();
}
return flag;
}
public OracleConnection conn = null;
private WriteData LA = new WriteData();
public bool insertValues(string TableName, string[] ColumnName, Type[] ColumnType, object[] ColumnValues)
{
bool flag = false;
try
{
this.conn.Open();
if ((ColumnName.Length == ColumnType.Length) && (ColumnName.Length == ColumnValues.Length))
{
string strCmd = "Insert Into" + TableName + "(";
for (int i = 0; i < ColumnName.Length; i++)
{
strCmd += ColumnName[i] + ",";
}
strCmd = strCmd.Remove(strCmd.Length - 1, 1);
strCmd += ") Values (";
for (int i = 0; i < ColumnType.Length; i++)
{
strCmd += "'" + ColumnValues[i].ToString() + "',";
strCmd += ColumnValues[i].ToString() + ",";
strCmd = strCmd.Remove(strCmd.Length - 1, 1) + ")";
}
cmd = new OracleCommand(strCmd, conn);
if (cmd.ExecuteNonQuery() != 0)
{
flag = true;
}
else
{
flag = false;
}
}
else
{
throw new Exception("Number of Arguments do not match");
}
}
catch (Exception exception)
{
this.LA.WriteLine(exception.Message);
}
finally
{
this.conn.Close();
}
return flag;
}