本文整理汇总了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();
}
示例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();
}
示例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();//数据绑定显示;
}
}
示例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 = "";
}
}
示例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 = "";
}
}
示例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();
}
示例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);
}