zoukankan      html  css  js  c++  java
  • ADO.NET朝花夕拾(二)

        protected void Page_Load(object sender, EventArgs e)
        {
            ShowDate();
        }

        
    void ShowDate()
        {

            
    using (SqlConnection con = new SqlConnection("server=.;database=huifeng;integrated security=true;"))
            {
                
    using (SqlCommand cmd = new  SqlCommand("select * from orderr Where id>@id1 And id<@id2", con))
                {
                    con.Open();
                    DataSet ds 
    = new DataSet();
                    SqlParameter[] ps 
    = {
                                        
    new SqlParameter("@id1",4),
                                        
    new SqlParameter("@id2",11)
                                        };
                    cmd.Parameters.AddRange(ps);

                    SqlDataAdapter sda 
    = new SqlDataAdapter(cmd);    
                    sda.Fill(ds,
    "table1");

                    
    for (int i = 0; i <ds.Tables["table1"].Rows.Count ; i++)
                    {
                        Response.Write(ds.Tables[
    "table1"].Rows[i][0].ToString()+"<br>");
                    }
                }
            }    
            

        }
  • 相关阅读:
    go学习笔记day19
    Mac11系统 SIP保护 如何在根目录创建data文件夹
    vue首页加载文件过多,去掉预加载
    NPM更换国内源
    autoCAD2007 图层
    读《现代JavaScript》笔记①——Map and Set(映射和集合)
    pubsubjs发布订阅
    vuecli中配置less并使用全局变量
    React组件通讯
    v6版reactrouterdom的改变
  • 原文地址:https://www.cnblogs.com/qixuejia/p/1659525.html
Copyright © 2011-2022 走看看