|
|
@@ -12,7 +12,7 @@ namespace UAS_PLCDataReader.DataOperate
|
|
|
//系统默认的的连接字符串
|
|
|
private string ConnectionStrings = Properties.Settings.Default.Properties["MES"].DefaultValue.ToString();
|
|
|
//用户选择的数据库的连接字符串
|
|
|
- public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=UAS_MES_PROD;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.17.158.219)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+ public static string DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=UAS_MES_PROD;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.253.6)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
public static OracleConnection connection = null;
|
|
|
OracleCommand command = null;
|
|
|
/// <summary>
|
|
|
@@ -697,7 +697,7 @@ namespace UAS_PLCDataReader.DataOperate
|
|
|
SavedID = new string[0];
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
//预防插入的DataTable中存在不属于该表的列,在进行下一步操作之前全部剔除
|
|
|
DataTable data = (DataTable)ExecuteSql("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", "select");
|
|
|
@@ -810,7 +810,19 @@ namespace UAS_PLCDataReader.DataOperate
|
|
|
//将第一个数组的下标固定为0作为循环添加的参数的名称
|
|
|
for (int i = 1; i <= names[0].Length; i++)
|
|
|
{
|
|
|
- command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
|
|
|
+ if (names[0][i - 1].ToString().ToUpper().Contains("DATE"))
|
|
|
+ {
|
|
|
+ DateTime[] time = new DateTime[names[i].Length];
|
|
|
+ for (int j = 0; j < names[i].Length; j++)
|
|
|
+ {
|
|
|
+ time[j] = Convert.ToDateTime(names[i][j]);
|
|
|
+ }
|
|
|
+ command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Date, time, ParameterDirection.Input));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
|
|
|
+ }
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
@@ -1105,7 +1117,7 @@ namespace UAS_PLCDataReader.DataOperate
|
|
|
|
|
|
public void Dispose()
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|