?? sqlexe.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// SQLExe 的摘要說明
/// </summary>
///
namespace SQLExe
{
public class SQLExe
{
public SQLExe()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
public DataSet GetDataSet(string str)
{
SqlConnection ST_myCon = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand ST_mycommand = new SqlCommand();
SqlDataAdapter myAdapter = new SqlDataAdapter();
DataSet ds = new DataSet();
ST_mycommand.Connection = ST_myCon;
ST_mycommand.CommandText = str;
try
{
ST_myCon.Open();
myAdapter.SelectCommand = ST_mycommand;
myAdapter.Fill(ds);
return ds;
}
catch (Exception exx)
{
throw (exx);
}
finally
{
ST_myCon.Close();
}
}
public void SQLstr(string str)
{
SqlConnection ST_myCon = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand ST_mycommand = new SqlCommand();
ST_mycommand.Connection = ST_myCon;
ST_mycommand.CommandText = str;
try
{
ST_myCon.Open();
ST_mycommand.ExecuteNonQuery();
}
catch (Exception exx)
{
throw (exx);
}
finally
{
ST_myCon.Close();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -