[Ajax.AjaxMethod()]
public DataSet GetDataSet()
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D: 项目工作分析 estdb.mdb ;保留安全信息=True;");
DataSet ds = new DataSet();
尝试
{
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "从 t_name 选择 *";
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
返回ds;
}
catch
{
conn.Close();
扔;
}
}
[/code]
// var ds =test.GetDataTable().value; //表数据源
//alert(ds.Rows[i].level2;
function getDataSet()
{
var ds =test.GetDataSet().value;
if (ds != null && typeof(ds) == "object" && ds.Tables != null)
{
var s = new Array()
s[s.length] = "< ;表格样式='边框:#000000 1px 颜色:#993333; 字体系列:'Microsoft Sans Serif';背景颜色:#ffff99;'>";
for(var i=0; i{
s[s.length] = "
";
s[s.length] = "; " ds.Tables[0].Rows[i].id " | ";
s[s.length] = "" ds.Tables[0].Rows[i]. f_date " | ";
s[s.length] = "" ds.Tables[0].Rows[i].f_name " | "; [s.length] = "
}
s[s.length] = "";
document.getElementById("div1").innerHTML = s.join("");
}
else
{
alert("调用Ajax接口函数错误!");
}
}