1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,313 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using AGVSystem.Cls;
|
||||
|
||||
namespace AGVSystem
|
||||
{
|
||||
// Token: 0x0200000A RID: 10
|
||||
public class ClsDBConn_sql
|
||||
{
|
||||
// Token: 0x06000094 RID: 148
|
||||
[DllImport("kernel32")]
|
||||
private static extern uint GetTickCount();
|
||||
|
||||
// Token: 0x06000095 RID: 149 RVA: 0x00011450 File Offset: 0x0000F650
|
||||
public void ConnClosed()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn != null;
|
||||
if (flag)
|
||||
{
|
||||
bool flag2 = this.sqlconn.State == ConnectionState.Open;
|
||||
if (flag2)
|
||||
{
|
||||
this.sqlconn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000096 RID: 150 RVA: 0x000114A8 File Offset: 0x0000F6A8
|
||||
public DataSet connDt(string str)
|
||||
{
|
||||
DataSet result;
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn.State != ConnectionState.Open;
|
||||
if (flag)
|
||||
{
|
||||
this.sqlconn.Open();
|
||||
}
|
||||
this.sqladapter = new SqlDataAdapter(str, this.sqlconn);
|
||||
this.sqlcommandb = new SqlCommandBuilder(this.sqladapter);
|
||||
bool flag2 = this.dt.Tables.Count > 0;
|
||||
if (flag2)
|
||||
{
|
||||
this.dt.Tables.Clear();
|
||||
}
|
||||
this.sqladapter.Fill(this.dt);
|
||||
result = this.dt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(string.Concat(new string[]
|
||||
{
|
||||
"SQL:",
|
||||
str,
|
||||
" , \r\n",
|
||||
ex.Message,
|
||||
" \r\n FunctionName:connDt"
|
||||
}), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000097 RID: 151 RVA: 0x00011594 File Offset: 0x0000F794
|
||||
public DataSet dtEdit(string str)
|
||||
{
|
||||
DataSet result;
|
||||
try
|
||||
{
|
||||
this.sqladapter = new SqlDataAdapter(str, this.sqlconn);
|
||||
this.sqlcommandb_ds = new SqlCommandBuilder(this.sqladapter);
|
||||
bool flag = this.dt.Tables.Count > 0;
|
||||
if (flag)
|
||||
{
|
||||
this.dt.Tables.Clear();
|
||||
}
|
||||
this.sqladapter.Fill(this.dt);
|
||||
result = this.dt;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(string.Concat(new string[]
|
||||
{
|
||||
"SQL:",
|
||||
str,
|
||||
" , \r\n",
|
||||
ex.Message,
|
||||
" \r\n FunctionName:dtEdit"
|
||||
}), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x06000098 RID: 152 RVA: 0x00011660 File Offset: 0x0000F860
|
||||
public bool dtCommit(DataSet ds)
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = ds.Tables[0].Rows.Count;
|
||||
this.sqladapter.Update(ds);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06000099 RID: 153 RVA: 0x000116B4 File Offset: 0x0000F8B4
|
||||
public bool connDGV(string str, DataGridView dgv)
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn.State == ConnectionState.Open;
|
||||
if (flag)
|
||||
{
|
||||
this.sqlconn.Close();
|
||||
}
|
||||
this.sqladapter = new SqlDataAdapter(str, this.sqlconn);
|
||||
bool flag2 = this.dt.Tables.Count > 0;
|
||||
if (flag2)
|
||||
{
|
||||
this.dt.Tables.Clear();
|
||||
}
|
||||
this.sqladapter.Fill(this.dt);
|
||||
bool flag3 = this.dt.Tables.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
dgv.DataSource = this.dt.Tables[0].Copy();
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(string.Concat(new string[]
|
||||
{
|
||||
"SQL:",
|
||||
str,
|
||||
" , \r\n",
|
||||
ex.Message,
|
||||
" \r\n FunctionName:connDGV"
|
||||
}), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600009A RID: 154 RVA: 0x000117BC File Offset: 0x0000F9BC
|
||||
public bool connDgvEdit(string str, DataGridView dgv)
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn.State == ConnectionState.Open;
|
||||
if (flag)
|
||||
{
|
||||
this.sqlconn.Close();
|
||||
}
|
||||
this.sqladapter = new SqlDataAdapter(str, this.sqlconn);
|
||||
bool flag2 = this.dt.Tables.Count > 0;
|
||||
if (flag2)
|
||||
{
|
||||
this.dt.Tables.Clear();
|
||||
}
|
||||
this.sqladapter.Fill(this.dt);
|
||||
this.sqlcommandb = new SqlCommandBuilder(this.sqladapter);
|
||||
this.bindsource.DataSource = this.dt.Tables[0];
|
||||
dgv.DataSource = this.dt.Tables[0];
|
||||
dgv.DataSource = this.bindsource;
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(string.Concat(new string[]
|
||||
{
|
||||
"SQL:",
|
||||
str,
|
||||
" , \r\n",
|
||||
ex.Message,
|
||||
" \r\n FunctionName:connDGVEdit"
|
||||
}), "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600009B RID: 155 RVA: 0x000118E4 File Offset: 0x0000FAE4
|
||||
public bool DgvCommit(DataGridView dgv)
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
dgv.EndEdit();
|
||||
this.bindsource.EndEdit();
|
||||
this.sqladapter.Update(this.dt.Tables[0]);
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message + " \r\n FunctionName:DgvCommit", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600009C RID: 156 RVA: 0x0001195C File Offset: 0x0000FB5C
|
||||
public string Command(string sqlstr)
|
||||
{
|
||||
string result;
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn.State != ConnectionState.Open;
|
||||
if (flag)
|
||||
{
|
||||
this.sqlconn.Open();
|
||||
}
|
||||
this.command = new SqlCommand(sqlstr, this.sqlconn);
|
||||
result = this.command.ExecuteNonQuery().ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result = string.Concat(new string[]
|
||||
{
|
||||
"SQL:",
|
||||
sqlstr,
|
||||
" , \r\n",
|
||||
ex.Message,
|
||||
" \r\n FunctionName:Command"
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600009D RID: 157 RVA: 0x000119FC File Offset: 0x0000FBFC
|
||||
public bool DtCommand(string Sqlstr, string[,] insertValue)
|
||||
{
|
||||
bool result;
|
||||
try
|
||||
{
|
||||
bool flag = this.sqlconn.State == ConnectionState.Open;
|
||||
if (flag)
|
||||
{
|
||||
this.sqlconn.Close();
|
||||
}
|
||||
this.sqladapter = new SqlDataAdapter(Sqlstr, this.sqlconn);
|
||||
bool flag2 = this.dt.Tables.Count > 0;
|
||||
if (flag2)
|
||||
{
|
||||
this.dt.Tables.Clear();
|
||||
}
|
||||
this.sqlcommandb = new SqlCommandBuilder(this.sqladapter);
|
||||
this.sqladapter.Fill(this.dt);
|
||||
for (int i = 0; i < insertValue.GetLength(0); i++)
|
||||
{
|
||||
DataRow dataRow = this.dt.Tables[0].NewRow();
|
||||
for (int j = 0; j < insertValue.GetLength(1); j++)
|
||||
{
|
||||
dataRow[j] = insertValue[i, j];
|
||||
}
|
||||
this.dt.Tables[0].Rows.Add(dataRow);
|
||||
}
|
||||
this.sqladapter.Update(this.dt);
|
||||
this.sqlconn.Close();
|
||||
result = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "错误!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Token: 0x0600009E RID: 158 RVA: 0x00011B64 File Offset: 0x0000FD64
|
||||
public void gg()
|
||||
{
|
||||
this.bindsource.AddNew();
|
||||
this.bindsource.MoveLast();
|
||||
}
|
||||
|
||||
// Token: 0x04000110 RID: 272
|
||||
private DataSet dt = new DataSet();
|
||||
|
||||
// Token: 0x04000111 RID: 273
|
||||
private SqlConnection sqlconn = new SqlConnection(Param.connectStr);
|
||||
|
||||
// Token: 0x04000112 RID: 274
|
||||
private SqlDataAdapter sqladapter = null;
|
||||
|
||||
// Token: 0x04000113 RID: 275
|
||||
private SqlCommandBuilder sqlcommandb = null;
|
||||
|
||||
// Token: 0x04000114 RID: 276
|
||||
private SqlCommandBuilder sqlcommandb_ds = null;
|
||||
|
||||
// Token: 0x04000115 RID: 277
|
||||
private BindingSource bindsource = new BindingSource();
|
||||
|
||||
// Token: 0x04000116 RID: 278
|
||||
private SqlCommand command = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user