当前位置: 首页>>代码示例>>C#>>正文


C# DataAccess.Fill方法代码示例

本文整理汇总了C#中DataAccess.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.Fill方法的具体用法?C# DataAccess.Fill怎么用?C# DataAccess.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataAccess的用法示例。


在下文中一共展示了DataAccess.Fill方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: load

 public void load()
 {
     DataAccess data = new DataAccess();
     data.Connection();
     string sqlcom = "select goodsid,goodsname,goodsprice,goodssort,connectpeople,phone from [Goods] ";
     SqlCommand cmd = data.excute(sqlcom);
     DataSet ds = data.Fill(cmd);
     GridView1.DataSource = ds.Tables[0].DefaultView;
     GridView1.DataBind();
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:10,代码来源:AdminDefault.aspx.cs

示例2: GridView1_PageIndexChanging

 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridView1.PageIndex = e.NewPageIndex;
     DataAccess data = new DataAccess();
     data.Connection();
     string sqlcom = "select goodsid,goodsname,goodsprice,goodssort,connectpeople,phone from [Goods] ";
     SqlCommand cmd = data.excute(sqlcom);
     DataSet ds = data.Fill(cmd);
     GridView1.DataSource = ds.Tables[0].DefaultView;
     GridView1.DataBind();
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:11,代码来源:AdminDefault.aspx.cs

示例3: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     String[] str = new String[] { "str1", "str2", "str3", "str4" };
     DataList[] list = new DataList[] { DataEle, DataBook, DataLife, DataOther };//创建datalist控件数组
     DataAccess data = new DataAccess();
     data.Connection();//链接数据库
     str[0] = "SELECT  goodsid,goodsname,goodsprice,images FROM [Goods] where goodssort='电子产品' order by goodsid desc";
     str[1] = "SELECT  goodsid,goodsname,goodsprice,images FROM [Goods] where goodssort='书籍' order by goodsid desc";
     str[2] = "SELECT  goodsid,goodsname,goodsprice,images FROM [Goods] where goodssort='生活用品' order by goodsid desc";
     str[3] = "SELECT  goodsid,goodsname,goodsprice,images FROM [Goods] where goodssort='其它' order by goodsid desc";
     for (int i = 0; i < 4; i++)
     {
         SqlCommand cmd = data.excute(str[i]);//执行sql语句;
         DataSet ds = data.Fill(cmd);
         list[i].DataSource = ds.Tables[0].DefaultView;
         list[i].DataBind();//数据绑定显示;
     }
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:18,代码来源:Default.aspx.cs

示例4: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     DataAccess data = new DataAccess();
     string sqlcom = "select * from [Admin] where Adminid='" + FunStr(Adminname.Text.Trim()) + "'and Apassword='" + FunStr(Adminpwd.Text.Trim()) + "'";
     data.Connection();
     SqlCommand cmd = data.excute(sqlcom);
     DataSet ds = data.Fill(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         Session["Adminid"] = Adminname.Text.Trim();
         Response.Redirect("AdminDefault.aspx");
     }
     else
     {
         Label1.Text = "您的用户名或密码错误";
         Adminname.Text = "";
     }
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:18,代码来源:Admin.aspx.cs

示例5: Button1_Click

 protected void Button1_Click(object sender, EventArgs e)
 {
     DataAccess data = new DataAccess();
     data.Connection();
     string sqlcom = "select * from [User] where Username='" + Username.Text.Trim() + "'and Upassword='" + userpassword.Text.Trim() + "'";
     SqlCommand cmd = data.excute(sqlcom);
     DataSet ds = data.Fill(cmd);
     if (ds.Tables[0].Rows.Count > 0)
     {
         Session["Username"] = Username.Text.Trim();
         Response.Redirect("person.aspx");
     }
     else
     {
         Label1.Text = "您的用户名或密码错误";
         Username.Text = "";
     }
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:18,代码来源:Login.aspx.cs

示例6: DataPage

    public void DataPage(string sqlcom, DataList MarketDetailDl, Label lblCurPage, Label lblTnum, Label lblEachPage, HyperLink lnkFirst, HyperLink lnkLast, HyperLink lnkPrev, HyperLink lnkNext, HttpRequest Request)
    {
        DataAccess data = new DataAccess();
        data.Connection();
        SqlCommand cmd = data.excute(sqlcom);
        DataSet ds = data.Fill(cmd);
        MarketDetailDl.DataSource = ds.Tables[0].DefaultView;
        MarketDetailDl.DataBind();
        PagedDataSource objPage = new PagedDataSource();//创建分页类
        objPage.DataSource = ds.Tables["Table"].DefaultView;//设置数据源

        objPage.AllowPaging = true;
        objPage.PageSize = 5;

        if (Request.QueryString["Page"] != null)
        {
            CurPage = Convert.ToInt32(Request.QueryString["Page"]);
            CurPage = Math.Min(CurPage, objPage.PageCount);
            CurPage = Math.Max(CurPage, 1);
        }
        else
            CurPage = 1;
        objPage.CurrentPageIndex = CurPage - 1;
        TotalPage = objPage.PageCount;
        Tnum = objPage.DataSourceCount;
        EachPage = objPage.Count;
        lblCurPage.Text = "第 " + CurPage.ToString() + " / " + TotalPage.ToString() + " 页";
        lblTnum.Text = "共: " + Tnum + " 条记录";
        lblEachPage.Text = "每页有: " + EachPage.ToString() + " 条记录";

        if (objPage.CurrentPageIndex != 0)
            lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage-CurPage +1);
        if (objPage.CurrentPageIndex != TotalPage - 1)
            lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(TotalPage);

        if (!objPage.IsFirstPage)
            lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
        if (!objPage.IsLastPage)
            lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);

        MarketDetailDl.DataSource = objPage;
        MarketDetailDl.DataBind();
    }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:43,代码来源:DataFill.cs

示例7: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] == null)
         Response.Redirect("Default.aspx");
     int id = Convert.ToInt32(Request.QueryString["id"].ToString());
     DataAccess data = new DataAccess();
     data.Connection();
     string sqlcom = "SELECT goodsname,goodsprice,phone,images,details FROM [Goods] where goodsid=" + id;
     SqlCommand cmd = data.excute(sqlcom);
     DataSet ds = data.Fill(cmd);
     gName.Text = ds.Tables[0].Rows[0][0].ToString();
     money.Text = ds.Tables[0].Rows[0][1].ToString();
     tel.Text = ds.Tables[0].Rows[0][2].ToString();
     Image1.ImageUrl = ds.Tables[0].Rows[0][3].ToString();
     Mes.Text = ds.Tables[0].Rows[0][4].ToString();
     string sqlcom1 = "select mescontent, Username, mestime  from [message] where goodsid=" + id;
     DataFill ds1 = new DataFill();
     ds1.DataPage(sqlcom1, DataList1, lblCurPage, lblTnum, lblEachPage, lnkFirst, lnkLast, lnkPrev, lnkNext, Request);
 }
开发者ID:clvn7,项目名称:FleaMarket,代码行数:19,代码来源:goods.aspx.cs


注:本文中的DataAccess.Fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。