QDuck
using System;
  using System.Data;
  using System.Data.SqlClient;
  namespace exchange
  {
   public class MyDataOp
  {
  private String StrSql;
  private String StrConn;
  private SqlConnection Conn;
  public MyDataOp(String ss)
  {
   StrSql = ss;
   StrConn = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
  }
 
  public SqlDataReader CreateReader()
  {
   Conn=new SqlConnection(StrConn);
   SqlCommand Comm=new SqlCommand(StrSql,Conn);
   Conn.Open();
   SqlDataReader MyReader = Comm.ExecuteReader();
   return MyReader;
  }
  public DataSet CreateDataSet()
  {
   Conn=new SqlConnection(StrConn);
   Conn.Open();
   SqlDataAdapter Adpt=new SqlDataAdapter(StrSql,Conn);
   DataSet Ds=new DataSet();
   Adpt.Fill(Ds);
   return Ds;
  }
  public SqlCommand ExecuteCommand()
  {
   Conn=new SqlConnection(StrConn);
   SqlCommand Comm=new SqlCommand(StrSql,Conn);
   Conn.Open();
   Comm.ExecuteNonQuery();
   return Comm;
  }
  public void Close()
  {
   Conn.Close();
  }
     }
 }

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-07-17
  • 2021-11-15
  • 2022-01-12
  • 2021-10-19
  • 2022-01-05
  • 2021-07-07
猜你喜欢
  • 2022-12-23
  • 2021-12-23
  • 2021-12-14
  • 2022-01-05
  • 2022-12-23
  • 2021-11-22
  • 2021-09-06
相关资源
相似解决方案