日期:2014-05-17 浏览次数:20901 次
case 0: //闭合水准
{
//连接access数据库
OleDbConnection dbConn = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0 ; Data Source = Adjustment.accdb;");
if (dbConn.State != ConnectionState.Open) dbConn.Open();
else MessageBox.Show("数据库已经被其他程序占用,请关闭先。");
OleDbCommand cmd = new OleDbCommand("DELETE from ClosedLeveling", dbConn); //首先清空表里面的数据
cmd.ExecuteNonQuery();
OleDbCommand cmd1 = new OleDbCommand("DELETE from CommonFields", dbConn);
cmd1.ExecuteNonQuery();
string strfh = textBox1.Text;
string strfr = textBox2.Text;
string strSumLength = textBox6.Text;
try
{
string cmdString = "INSERT INTO CommonFields([ID],[fh],[fr],[SumLength],[ProjectName],[MyGrade],[Calculator],[Checker]) VALUES('1','" + strfh + "','" + strfr + "','" + strSumLength + "','" + strProjectName + "','" + strMyGrade + "','" + strCalculator + "','" + strChecker + "')";
&nb