?? dbclass.cs
字號:
?using System;
using System.Data;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
namespace WindowsApplication1
{
public class DBClass
{
static Settings1 s1 = new Settings1();
static string connString = Settings1.Default.Stock;
static string connStringFB = Settings1.Default.FenBi;
public OleDbConnection conn = new OleDbConnection(connString);
public OleDbConnection connFB = new OleDbConnection(connStringFB);
public DataSet GetDataSet(string sql)
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
OleDbDataAdapter dapter = new OleDbDataAdapter(sql, conn);
DataSet ds = new DataSet();
try
{
dapter.Fill(ds);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
return ds;
}
public int ExcuteSQL(string sql)
{
int i = 0;
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
OleDbCommand Comm = new OleDbCommand(sql, conn);
try
{
i = Comm.ExecuteNonQuery();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
return i;
}
public DataSet GetDataSetFB(string sql)
{
if (connFB.State == ConnectionState.Closed)
{
connFB.Open();
}
OleDbDataAdapter dapter = new OleDbDataAdapter(sql, connFB);
DataSet ds = new DataSet();
try
{
dapter.Fill(ds);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
return ds;
}
public int ExcuteSQLFB(string sql)
{
int i = 0;
if (connFB.State == ConnectionState.Closed)
{
connFB.Open();
}
OleDbCommand Comm = new OleDbCommand(sql, connFB);
try
{
i = Comm.ExecuteNonQuery();
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
return i;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -