本文整理汇总了C#中SQLHelper.Get_DataSet方法的典型用法代码示例。如果您正苦于以下问题:C# SQLHelper.Get_DataSet方法的具体用法?C# SQLHelper.Get_DataSet怎么用?C# SQLHelper.Get_DataSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLHelper
的用法示例。
在下文中一共展示了SQLHelper.Get_DataSet方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getNewsDt
public DataTable getNewsDt()
{
SQLHelper db = new SQLHelper();
try
{
string pagesize = Pager1.PageSize.ToString();
string curpage = pg.request(Pager1.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "15";
if (curpage == "") curpage = "1";
string sql = @"SELECT id,ColorName,ColorValue,SUBSTRING((''000''+CONVERT(varchar,OrderId)),LEN(''000''+CONVERT(varchar,OrderId))-3,4) AS OrderId FROM " + com.tablePrefix + "Color ORDER BY OrderId";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager1.RecordCount = rowCount;
if (rowCount == 0) Pager1.Visible = false;
return dt;
}
catch (Exception ex)
{
Response.Write("2. " + ex.Message + "。");
//Response.End();
return null;
}
}
示例2: getNewsDt
public DataTable getNewsDt()
{
SQLHelper db = new SQLHelper();
try
{
string pagesize = Pager1.PageSize.ToString();
string curpage = pg.request(Pager1.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "10";
if (curpage == "") curpage = "1";
string sql = "SELECT id,name,OrderId,JianCheng FROM " + com.tablePrefix + "province WHERE 1=1 ";
sql += " ORDER BY OrderId";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager1.RecordCount = rowCount;
//if (rowCount == 0) Pager1.Visible = false;
return dt;
}
catch (NullReferenceException ex)
{
Response.Write("2. " + ex.Message + "。");
//Response.End();
return new DataTable();
}
}
示例3: bindGv
public void bindGv(bool addNewRow)
{
lbid = hlbid.Value;
SQLHelper db = new SQLHelper();
string pagesize = Pager2.PageSize.ToString();
string curpage = pg.request(Pager2.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "5";
if (curpage == "") curpage = "1";
string sql = @"SELECT *
FROM "[email protected]"News
WHERE lbid=" + lbid;
sql += " ORDER BY isTop DESC,IsIndex DESC,EditTime DESC";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager2.RecordCount = rowCount;
if (rowCount == 0) Pager2.Visible = false;
if (addNewRow)
{
DataRow newRow = dt.NewRow();
dt.Rows.Add(newRow);
}
GV.DataSource = dt.DefaultView;
GV.DataBind();
}
示例4: getNewsDt
public DataTable getNewsDt()
{
productid = hlbid.Value;
SQLHelper db = new SQLHelper();
string pagesize = Pager0.PageSize.ToString();
string curpage = pg.request(Pager0.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "20";
if (curpage == "") curpage = "1";
string sql = @"SELECT c.imgTypeName,b.ColorValue,b.ColorName
,SUBSTRING((''000''+CONVERT(varchar,b.OrderId)),LEN(''000''+CONVERT(varchar,b.OrderId))-2,3)+''-''+b.ColorName AS ColorText
,a.*
FROM "[email protected]"News a LEFT JOIN "[email protected]"Color b ON a.colorId=b.id
LEFT JOIN "[email protected]"ProductImgType c ON c.id =a.pro_imgTypeid
WHERE a.ParentNewsID=" + productid;
sql += " ORDER BY a.OrderId";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager0.RecordCount = rowCount;
if (rowCount == 0) Pager0.Visible = false;
return dt;
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
/*
lbid lbname parentid
1 Mian质新闻 0
2 Mian新闻 1
3 Mian百科 1
4 Mian故事 1
5 Mian尚前沿 1
6 Mian最行动 0
7 Mian事预告 6
8 爱Mian行动 6
9 Mian享瞬间 0
10 精采瞬间 9
11 Mian影像 9
12 Mian教堂 9
13 Mian在身边 0
14 微Mian互动 13
15 Mian下载 13
16 乐Mian游戏 13
17 图片集管理 10
*/
string lbid = pg.request("lbid");
if (lbid == "") lbid = "8";
string pagesize = pg.request("pagesize");
string curpage = pg.request("curpage");
string pageCount = "";//总页数
if (pagesize == "") pagesize = "5";
if (curpage == "") curpage = "1";
string lbname = clsLB.getLbname(lbid);
SQLHelper db = new SQLHelper();
string sql = "SELECT NewsID AS ID,Title,pic,href AS LinkUrl FROM News WHERE lbid=" + lbid + " ORDER BY EditTime DESC";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0][2].ToString();
string strJson = string.Empty;
strJson = com.DataTableToJson(lbname, dt, pageCount);
Response.Write(strJson);
Response.End();
}
示例6: getNewsDt
public DataTable getNewsDt()
{
lbid = hlbid.Value;
SQLHelper db = new SQLHelper();
try
{
if (Pager1 == null)
{
Response.Write("2.1 Pager1 == null。");
}
if (Pager1.PageSize == null)
{
Response.Write("2.2 Pager1.PageSize == null。");
}
string pagesize = Pager1.PageSize.ToString();
string curpage = pg.request(Pager1.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "20";
if (curpage == "") curpage = "1";
string sql = @"SELECT NewsID,Title,Pic,Description,OrderId
FROM "[email protected]"News
WHERE lbid=" + lbid;
sql += " ORDER BY title";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager1.RecordCount = rowCount;
if (rowCount == 0) Pager1.Visible = false;
return dt;
}
catch (NullReferenceException ex)
{
Response.Write("2. " + ex.Message + "。");
//Response.End();
return new DataTable();
}
}
示例7: getNewsDt
public DataTable getNewsDt()
{
SQLHelper db = new SQLHelper();
string pagesize = PagerMember.PageSize.ToString();
string curpage = pg.request(PagerMember.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "10";
if (curpage == "") curpage = "1";
string sql = @"SELECT * FROM " + com.tablePrefix + "Members ORDER BY RegTime DESC";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
PagerMember.RecordCount = rowCount;
if (rowCount == 0) PagerMember.Visible = false;
return dt;
}
示例8: getNewsDt
public DataTable getNewsDt()
{
lbid = hlbid.Value;
SQLHelper db = new SQLHelper();
string pagesize = Pager2.PageSize.ToString();
string curpage = pg.request(Pager2.PagePara);
string pageCount = "";//总页数
int rowCount = 0;
if (pagesize == "") pagesize = "5";
if (curpage == "") curpage = "1";
string sql = @"SELECT *
FROM "[email protected]"News
WHERE lbid=" + lbid;
sql += " ORDER BY isTop DESC,IsIndex DESC,AddTime DESC";
sql = "exec sp_GetPageData '" + sql + "'," + curpage + "," + pagesize;
db.sql = sql;
DataSet ds = db.Get_DataSet();
DataTable dt = ds.Tables[2];
pageCount = ds.Tables[1].Rows[0]["COUNTPAGE"].ToString();
rowCount = Int32.Parse(ds.Tables[1].Rows[0]["ROWCOUNT"].ToString());
Pager2.RecordCount = rowCount;
if (rowCount == 0) Pager2.Visible = false;
return dt;
}