connectiontable.cs
来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 47 行
CS
47 行
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace WindowsApplication.ConnectionTable
{
public class ConnectionTable
{
private static SqlDataAdapter sqlDataAdapter=new SqlDataAdapter();
private static SqlCommand sqlSelect=new SqlCommand();
private static SqlCommand sqlInsert=new SqlCommand();
private static SqlCommand sqlUpdate=new SqlCommand();
private static SqlCommand sqlDelete=new SqlCommand();
private static SqlConnection sqlConnection=new SqlConnection();
private static string connectionStr="workstation id=localhost;Integrated security=SSPI;database=SystemODBC;";
static ConnectionTable()
{
sqlDataAdapter.SelectCommand=sqlSelect;
sqlDataAdapter.InsertCommand=sqlInsert;
sqlDataAdapter.UpdateCommand=sqlUpdate;
sqlDataAdapter.DeleteCommand=sqlDelete;
}
public ConnectionTable()
{
}
public static int ExcuteDataTable(string sql)
{
int tempTable=0;
try
{
sqlConnection.ConnectionString=ConnectionTable.connectionStr;
ConnectionTable.sqlSelect.CommandText=sql;
tempTable=ConnectionTable.sqlSelect.ExecuteNonQuery();
}
catch(Exception ele)
{
ele.ToString();
}
return tempTable;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?