Suppose there is such a method in index. CS,
[Ajaxpro. ajaxmethod]
Public dataset getdataset ()
{
Dataset DS = new dataset ();
Sqldataadapter sap = new sqldataadapter ("select * from jobs", DB. getconn ());
Sap. Fill (DS, "Jobs ");
Return Ds;
}
How can we set the value at the front-end,
Function getdata ()
{
// Obtain the returned data. The current status is of the object type.
VaR OBJ = _ default. getdataset ();
// Obtain the data set
VaR DS = obj. value;
// The subsequent operations are similar to those in time. Note that the number of rows is the Length attribute.
VaR Len = Ds. Tables [0]. Rows. length;
// Obtain the data table in the dataset
VaR TBL = Ds. Tables [0];
// Prepare to display dataset in a table
VaR tblhtml = "<Table border = 1> ";
Tblhtml + = "<tr> ";
// Similarly, the column number attribute here is also Length
For (var j = 0; j <TBL. Columns. length; j ++)
{
// Obtain the column header
Tblhtml + = "<TH>" + TBL. Columns [J]. Name + "</Th> ";
}
Tblhtml + = "</tr> ";
// Specific data
For (VAR I = 0; I <TBL. Rows. length; I ++)
{
Tblhtml + = "<tr> ";
For (var j = 0; j <TBL. Columns. length; j ++)
{
// Obtain data in each column of each row
Tblhtml + = "<TD>" + TBL. Rows [I] [TBL. Columns [J]. Name] + "</TD> ";
}
Tblhtml + = "</tr> ";
}
Tblhtml + = "</table> ";
// Obtain the front-end Div
VaR divpro = Document. getelementbyid ("divpro ");
// Fill Div data
Divpro. innerhtml = tblhtml;
}
At this point, the dataset is displayed on the front-end.
Http://www.cnblogs.com/xiangpiren/archive/2007/08/26/869920.html