www.pudn.com > WEBrsgl6.20.rar > GridView.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Data;
namespace PublicPunction
{
public class GridView
{ ///
/// 绑定GridView 成功时返回ok 出错时返回出错信息
///
/// GridView
/// DataView 视图
/// New View
static public string bindGridView(System.Web.UI.WebControls.GridView grdv, DataView davi)
{
string Return="ok";
try
{
grdv.DataSource = davi;
grdv.DataBind();
}
catch(Exception ex)
{
Return = ex.Message.ToString();
}
return Return;
}
///
///
///
///
///
///
static public string bindGridView(System.Web.UI.WebControls.GridView grdv, string sql)
{
DataView davi;
string Return = "ok";
try
{
DataAccess.DataBase d = new DataAccess.DataBase();
davi = d.View(sql);
grdv.DataSource = davi;
grdv.DataBind();
}
catch (Exception ex)
{
Return = ex.Message.ToString();
}
return Return;
}
}
}