📄 daysearchframe.cs
字号:
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO Day_Statictis_Table(职工名称, 统计日期, 统计星期, 统计时间, 未到次数, 迟到次数, 备注) VALUES (@" +
"职工名称, @统计日期, @统计星期, @统计时间, @未到次数, @迟到次数, @备注); SELECT 编号, 职工名称, 统计日期, 统计星期, 统计时间" +
", 未到次数, 迟到次数, 备注 FROM Day_Statictis_Table WHERE (编号 = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职工名称", System.Data.SqlDbType.VarChar, 50, "职工名称"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计日期", System.Data.SqlDbType.VarChar, 50, "统计日期"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计星期", System.Data.SqlDbType.VarChar, 50, "统计星期"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计时间", System.Data.SqlDbType.VarChar, 50, "统计时间"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@未到次数", System.Data.SqlDbType.VarChar, 50, "未到次数"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@迟到次数", System.Data.SqlDbType.VarChar, 50, "迟到次数"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 50, "备注"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 编号, 职工名称, 统计日期, 统计星期, 统计时间, 未到次数, 迟到次数, 备注 FROM Day_Statictis_Table";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Day_Statictis_Table SET 职工名称 = @职工名称, 统计日期 = @统计日期, 统计星期 = @统计星期, 统计时间 = @统计时间, 未到次数 = @未到次数, 迟到次数 = @迟到次数, 备注 = @备注 WHERE (编号 = @Original_编号) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (未到次数 = @Original_未到次数 OR @Original_未到次数 IS NULL AND 未到次数 IS NULL) AND (统计日期 = @Original_统计日期 OR @Original_统计日期 IS NULL AND 统计日期 IS NULL) AND (统计时间 = @Original_统计时间 OR @Original_统计时间 IS NULL AND 统计时间 IS NULL) AND (统计星期 = @Original_统计星期 OR @Original_统计星期 IS NULL AND 统计星期 IS NULL) AND (职工名称 = @Original_职工名称 OR @Original_职工名称 IS NULL AND 职工名称 IS NULL) AND (迟到次数 = @Original_迟到次数 OR @Original_迟到次数 IS NULL AND 迟到次数 IS NULL); SELECT 编号, 职工名称, 统计日期, 统计星期, 统计时间, 未到次数, 迟到次数, 备注 FROM Day_Statictis_Table WHERE (编号 = @编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@职工名称", System.Data.SqlDbType.VarChar, 50, "职工名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计日期", System.Data.SqlDbType.VarChar, 50, "统计日期"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计星期", System.Data.SqlDbType.VarChar, 50, "统计星期"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@统计时间", System.Data.SqlDbType.VarChar, 50, "统计时间"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@未到次数", System.Data.SqlDbType.VarChar, 50, "未到次数"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@迟到次数", System.Data.SqlDbType.VarChar, 50, "迟到次数"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 50, "备注"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_未到次数", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "未到次数", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_统计日期", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "统计日期", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_统计时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "统计时间", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_统计星期", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "统计星期", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_职工名称", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "职工名称", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_迟到次数", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "迟到次数", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.Int, 4, "编号"));
//
// dayStaticSet
//
this.dayStaticSet.DataSetName = "DayStaticSet";
this.dayStaticSet.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Day_Statictis_Table", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("职工名称", "职工名称"),
new System.Data.Common.DataColumnMapping("统计日期", "统计日期"),
new System.Data.Common.DataColumnMapping("统计星期", "统计星期"),
new System.Data.Common.DataColumnMapping("统计时间", "统计时间"),
new System.Data.Common.DataColumnMapping("未到次数", "未到次数"),
new System.Data.Common.DataColumnMapping("迟到次数", "迟到次数"),
new System.Data.Common.DataColumnMapping("备注", "备注")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 编号, 职工名称, 统计日期, 统计星期, 统计时间, 未到次数, 迟到次数, 备注 FROM Day_Statictis_Table WHERE " +
"(职工名称 LIKE @Param4) AND (统计日期 LIKE @Param5) AND (统计星期 LIKE @Param6)";
this.sqlSelectCommand2.Connection = this.sqlConnection2;
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 50, "职工名称"));
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 50, "统计日期"));
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 50, "统计星期"));
//
// sqlConnection2
//
this.sqlConnection2.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
//
// DaySearchFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(746, 423);
this.Name = "DaySearchFrame";
this.Text = "DaySearchFrame";
this.Load += new System.EventHandler(this.DaySearchFrame_Load);
((System.ComponentModel.ISupportInitialize)(this.statusZhuangTai)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ds)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusText)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dayStaticSet)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region DataFunction
private DataTable ExcuteSql(string strSql,string tableName)
{
DataSet dsSet=new DataSet();
DataTable dsTable=new DataTable();
try
{
dsSet=conn.ExcuteDataSetResult(strSql,tableName);
dsTable=dsSet.Tables[0];
}
catch(Exception eles)
{
MessageBox.Show(this,eles.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
return dsTable;
}
#endregion
#region Init Event...
private void DaySearchFrame_Load(object sender, System.EventArgs e)
{
try
{
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%%";
this.sqlDataAdapter1.Fill(this.dayStaticSet);
this.sqlDataAdapter.Fill(dayStaticSet);
base.ds=dayStaticSet;
base.statusText.Text="记录:"+this.selectCount().Trim();
base.dataAdapter=this.sqlDataAdapter;
this.dayTable=dayStaticSet.Tables[0];
base.dataGrid.DataSource=this.dayTable;
base.cmOrders=(System.Windows.Forms.CurrencyManager) BindingContext[this.dayTable];
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region selectCount() private String selectCount() { string count="select count(*) from Day_Statictis_Table",tempStr=""; DataTable tempTable=new DataTable(); tempTable=ExcuteSql(count,"Day_Statictis_Table"); for(int i=0;i<tempTable.Rows.Count;i++) { tempStr=tempTable.Rows[i][0].ToString().Trim(); } return tempStr; } #endregion
#region 查询事件....
private void btnSearch_Click(object sender, System.EventArgs e)
{
try
{
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%%";
if(this.textSearchA.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%"+this.textSearchA.Text+"%";
}
else if(this.textSearchB.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%"+this.textSearchB.Text+"%";
}
else if(this.textSearchC.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%"+this.textSearchC.Text+"%";
}
this.dayStaticSet.Day_Statictis_Table.Clear();
this.sqlDataAdapter1.Fill(dayStaticSet);
base.dataAdapter=this.sqlDataAdapter1;
base.dataGrid.DataSource=dayStaticSet.Tables[0];
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -