提示 DataGrid1.DataSource = null 为什末绑定不成功?????
senzz 2003-08-18 04:23:10 我做了一个弹出页面,接受主页面传过来的值,然后这些值查询数据库,取出数据放在DataTable里,再用dataset.Tables.Add(DataTable),填充数据到dataset里
象如下与datagrid绑定,为什末不行?
提示 DataGrid1.DataSource = null ;
public class ClientSearch : System.Web.UI.Page
{
protected ODBiz.Client dataClient = new ODBiz.Client();
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Data.DataSet dataSet1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
this.txtCustomer.Text = Request["CustomerName"];
this.txtAccount.Text = Request["AccountId"];
string CustomerName = this.txtCustomer.Text;
string AccountId = this.txtAccount.Text;
//写在 .cs 文件中
dataClient.SearchCustomer(
ref CustomerName,
ref AccountId,
dataSet1 );
DataGrid1.DataSource = dataSet1.Tables["CustomerSearch"];//新生成的datatable,名称为CustomerSearch
this.DataGrid1.DataBind();
}
}