⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlexe.cs

📁 本程序是一个宾馆管理系统
💻 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 + -