/// <summary>
        /// 执行查询语句,返回DataSet
        /// </summary>
        /// <param name="SQLString">查询语句</param>
        /// <returns>DataSet</returns>
        public static  DataSet Query(string SQLString)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    DataSet ds = new DataSet();
                    try
                    {
                        connection.Open();
                        SqlDataAdapter command = new SqlDataAdapter(SQLString, connection);
                        command.Fill(ds, "ds");
                    }
                    catch (System.Data.SqlClient.SqlException ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    return ds;
                }
            }
            catch(Exception err)
            {
               
                return null;
            }
        }

 

相关文章:

  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-05-31
  • 2021-10-15
  • 2021-07-12
  • 2021-10-13
猜你喜欢
  • 2021-12-14
  • 2021-08-07
  • 2021-10-08
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案