[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);

解决方案 »

  1.   

    你真强还返回二维数组
    你返回json数组吧
     这些是要在客户端执行的
      

  2.   

     var ds = request.value;
            alert(ds[0][0]);
    ???
    js里面认这个东西么?
      

  3.   

    Json 说通俗一点就是把对象用string表示
     { "people": [   { "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" },   { "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"},   { "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" }   ]}