62,272
社区成员
发帖
与我相关
我的任务
分享 [AjaxPro.AjaxMethod]
public string[, ] SearchPrj(string strPrj)
{
SqlConnection con = new SqlConnection(strConstring);
//SqlCommand com = con.CreateCommand();
con.Open();
//插入完,要知道插入的自增ID
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(string.Format("select * from projects where projectname like '%{0}%'", tbSearch.Text.Trim()), con);
da.Fill(ds);
string[,] strDS = new string[ds.Tables[0].Rows.Count, ds.Tables[0].Columns.Count];
for (int i=0; i<ds.Tables[0].Rows.Count; i++)
{
for (int j=0;j<ds.Tables[0].Columns.Count;j++)
{
strDS[i, j] = ds.Tables[0].Rows[i][j].ToString();
}
}
return strDS;
}function Call_Back(request){
if (request.error) {
return alert("发生错误\n" + request.error.Message);
}
debugger;
var ds = request.value;
alert(ds[0][0]);
}
function btnJsSearch_onclick() {
var str = document.getElementById("tbSearch").value;
Map.SearchPrj(str, Call_Back); { "people": [ { "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" }, { "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"}, { "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" } ]}