📄 linkdatabase.cs
字号:
//using System;
//using System.Data;
//using System.Data.SqlClient;
//using System.Data.OleDb;
//namespace bookmanager
//{
// /// <summary>
// /// Summary description for LinkDataBase.
// /// </summary>
// public class LinkDataBase
// {
// private string strSQL;
// //與SQL Server的連接字符串設置
// private string connectionString = "workstation id=localhost;Integrated Security=SSPI;database=citi_erp_to;user=sa;password=infonets;";
// //與數據庫的連接
// private SqlConnection myConnection;
//
// private SqlCommandBuilder sqlCmdBld;
// private DataSet ds = new DataSet();
// private SqlDataAdapter da;
// public LinkDataBase()
// {
// //
// // TODO: Add constructor logic here
// //
// }
// public DataSet SelectDataBase(string tempStrSQL,string tempTableName)
// {
// this.strSQL = tempStrSQL;
// this.myConnection = new SqlConnection(connectionString);
// this.da = new SqlDataAdapter(this.strSQL,this.myConnection);
// this.ds.Clear();
// this.da.Fill(ds,tempTableName);
// return ds;//返回填充了数据的DATASET,其中数据表tempTableName给出的字符串命名
// }
//
// //數據庫數據更新(傳DataSet和DataTable的對象)
// public DataSet UpdateDataBase(DataSet changedDataSet,string tableName)
// {
// this.myConnection = new SqlConnection(connectionString);
// this.da = new SqlDataAdapter(this.strSQL,this.myConnection);
// this.sqlCmdBld = new SqlCommandBuilder(da);
// this.da.Update(changedDataSet,tableName);
// return changedDataSet;//返回更新了的數據庫表
// }
//
// ///////////////////////////////// 直接操作數據庫(未創建該類的實例時直接用) /////////////////////////////////////////////////////
//
// //檢索數據庫數據(傳字符串,直接操作數據庫)
// public DataTable SelectDataBase(string tempStrSQL)
// {
// this.myConnection = new SqlConnection(connectionString);
// DataSet tempDataSet = new DataSet();
// this.da = new SqlDataAdapter(tempStrSQL,this.myConnection);
// this.da.Fill(tempDataSet);
// return tempDataSet.Tables[0];
// }
//
// //數據庫數據更新(傳字符串,直接操作數據庫)
// public int UpdateDataBase(string tempStrSQL)
// {
// this.myConnection = new SqlConnection(connectionString);
// //使用Command之前一定要先打開連接,後關閉連接,而DataAdapter則會自動打開關閉連接
// myConnection.Open();
// SqlCommand tempSqlCommand = new SqlCommand(tempStrSQL,this.myConnection);
// int intNumber = tempSqlCommand.ExecuteNonQuery();//返回數據庫中影響的行數
// myConnection.Close();
// return intNumber;
// }
// }
//}
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -