zoukankan      html  css  js  c++  java
  • C#中读取存储过程中临时表中的数据的写法

     public DataTable GetOpticalInfo(string begindate, string enddate, string prefromid)
            {
                const string connStr = @"Data Source=127.0.0.1;DataBase=master;User ID=sa;PWD=123"

                var conn = new SqlConnection(connStr);
                var ds = new DataSet();
                var dt = new DataTable();
                var strsql = "select * from ##临时表";
                strsql += " where 1=1";
                if (begindate != null && enddate != null)
                    strsql += " and 入库时间 between '" + begindate + "' and '" + enddate + "'";
                       strsql += " order by id desc";
                try
                {
                    conn.Open();
                    var cmd = new SqlCommand(strsql, conn);
                    SqlDataAdapter adp = new SqlDataAdapter(cmd);
                    adp.Fill(ds, "table1");
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    conn.Close();
                }
                dt = ds.Tables[0];
                return dt;
            }

  • 相关阅读:
    删除指定日期的文件
    pytorch加载数据集
    pytorch ResNet
    pytorch GoogLeNet
    pytorch实现VGG
    pytorch训练AlexNet
    序列化.Net对象到JSON
    c#对象序列化 用来保存对象数据
    Wpf设置listview样式
    wpf listview添加自增序号
  • 原文地址:https://www.cnblogs.com/QiuJL/p/4524229.html
Copyright © 2011-2022 走看看