cs 返回数据库中的某个字段,你可以构造自己的字符
[Ajax.AjaxMethod()]
public static string getDataSet()
{
SqlDataBase SqlDB=new SqlDataBase(DSN);
string strsql=String.Format(” Select * From User Where IsPower=0″,”User”);
DataSet ds=SqlDB.CreateSet(strsql,”IU_User”);
SqlDB.CloseConnection();
return ds.Tables[0].Rows[0][0].ToString();
}
[Ajax.AjaxMethod()]
public static string getDataSet()
{
SqlDataBase SqlDB=new SqlDataBase(DSN);
string strsql=String.Format(” Select * From User Where IsPower=0″,”User”);
DataSet ds=SqlDB.CreateSet(strsql,”IU_User”);
SqlDB.CloseConnection();
return ds.Tables[0].Rows[0][0].ToString();
}
client side
function getDataSet(){
WebForm1.getDataSet(GetDataSet_callback);
}
function GetDataSet_callback(response)
{
var ds = response.value; //获取服务端的数据
alert(ds); //显示数据
}
< INPUT style=”Z-INDEX: 101; LEFT: 456px; WIDTH: 56px; POSITION: absolute; TOP: 96px; HEIGHT: 24px” type=”button” value=”test” >
欢迎大家阅读《Ajax获取数据库中的字段_jquery》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码