相思资源网 Design By www.200059.com
[Ajax.AjaxMethod()]
public DataSet GetDataSet()
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:工作项目分析 estdb.mdb;Persist Security Info=True;");
DataSet ds = new DataSet();
try
{
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from t_name";
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
return ds;
}
catch
{
conn.Close();
throw;
}
}
[/code]
复制代码 代码如下:
<script language="JavaScript">
// var ds =test.GetDataTable().value; //table数据源
//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] = "<table style='border: #000000 1px solid; color: #993333; font-family: 'Microsoft Sans Serif'; background-color: #ffff99;'>";
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
s[s.length] = "<tr>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].id + "</td>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].f_date + "</td>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].f_name + "</td>";
s[s.length] = "</tr>";
}
s[s.length] = "</table>";
document.getElementById("div1").innerHTML = s.join("");
}
else
{
alert("调用Ajax接口函数错误!");
}
}
</script>
public DataSet GetDataSet()
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:工作项目分析 estdb.mdb;Persist Security Info=True;");
DataSet ds = new DataSet();
try
{
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from t_name";
cmd.CommandType = CommandType.Text;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
return ds;
}
catch
{
conn.Close();
throw;
}
}
[/code]
复制代码 代码如下:
<script language="JavaScript">
// var ds =test.GetDataTable().value; //table数据源
//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] = "<table style='border: #000000 1px solid; color: #993333; font-family: 'Microsoft Sans Serif'; background-color: #ffff99;'>";
for(var i=0; i<ds.Tables[0].Rows.length; i++)
{
s[s.length] = "<tr>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].id + "</td>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].f_date + "</td>";
s[s.length] = "<td>" + ds.Tables[0].Rows[i].f_name + "</td>";
s[s.length] = "</tr>";
}
s[s.length] = "</table>";
document.getElementById("div1").innerHTML = s.join("");
}
else
{
alert("调用Ajax接口函数错误!");
}
}
</script>
标签:
js,DataSet,数据源
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无js DataSet数据源处理代码的评论...