[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);
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);
解决方案 »
- 喜欢javascript的请来回答
- 偶今天感到很耻辱?国民最基础的服务都要收钱?
- 图文新闻的问题..
- IE 不能显示 控件
- 如何将新建立的datatable写入数据库啊
- 求更新图片的源码和方法,想在detailsView中用fileupload更新图片
- 数据库连接方式的讨论
- 动态生成的datagrid控件或者其他控件怎么让他在页面的指定位置显示??
- 使用AspNetMenu控件,菜单中文字体显示有问题!顺便发布IT公司速查手册,新的一年找工作必看!
- 快来人啊,简单问题,快帮我解决for 初始化变量 未引用的问题
- 服务器上同时有sql2000和sql2005的问题
- 求助reportviewer动态绑定数据源
你返回json数组吧
这些是要在客户端执行的
alert(ds[0][0]);
???
js里面认这个东西么?
{ "people": [ { "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" }, { "firstName": "Jason", "lastName":"Hunter", "email": "bbbb"}, { "firstName": "Elliotte", "lastName":"Harold", "email": "cccc" } ]}