从Webservice返回DataTable [英] Return DataTable From Webservice
本文介绍了从Webservice返回DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在代码中从webservice返回datatable。在做R& D时,我只是从webservice返回数据集,但现在它给错误xml无效。请查看代码并指导我如何解决更多...这是我的代码:
i am returning datatable from the webservice in my code . while doing R&D , i just return the dataset from the webservice but now its giving the error invalid xml .Please review the code and guide me how to solve more ...here is my code :
[WebMethod]
public DataSet GetAllExhibitionList()
{
DALSearch objdal = new DALSearch();
return objdal.GetAllExhibitionDetail();
}
public DataSet GetAllExhibitionDetail()
{
try
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "proc_getAllExhibitionList";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dtexhibitiondetail1);
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
return dtexhibitiondetail1;
}
<script type="text/javascript">
$(function () {
debugger;
$.ajax({
type: 'post',
url: 'WebServices/DataLoading.asmx/GetAllExhibitionList',
data: {},
contentType: 'application:JSON;charset:UTF-8',
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
});
function OnSuccess(response) {
$("[id*=dlallexhibitation]").attr("border", "1");
var xmlDoc = $.parseXML(response.d);
alert(xmlDoc);
var xml = $(xmlDoc);
var customers = xml.find("Table");
var row = $("[id*=dlallexhibitation] tr:last-child").clone(true);
$("[id*=dlallexhibitation] tr:last-child").remove();
$.each(customers, function () {
var customer = $(this);
$("#lblMsg", row).html($(this).find("#lblMsg").text());
$(".mainRow", row).attr('indusid');
$(".mainRow", row).attr('cid');
$(".mainRow", row).attr('coid');
$(".mainRow", row).attr('mid');
$(".mainRow", row).attr('yid');
$(".in_venues_des2_mn", row).find('.in_ven_hd2 a').html($(this).find(".in_ven_hd2").text());
$(".in_venues_des2_mn", row).find('.sub_in_venues_des2_mn').text();
$(".dates", row).find('.sub_dates').text();
$(".dates", row).find('.filter_dates').text();
$(".in_venues_des3", row).text();
$(".img_thumb2", row).find('img').attr('src');
$('.in_venues_des6').text();
$('in_ven_navs2').find('.in_ven_more').find('a').attr('href');
$('in_ven_navs2').find('.in_ven_more').find('a').attr('exhibitionid');
$('in_ven_navs2').find('.in_nav3').attr('exhibitionid');
$('in_ven_navs2').find('.in_nav3').find('a').attr('href');
$("[id*=dlallexhibitation]").append(row);
row = $("[id*=dlallexhibitation] tr:last-child").clone(true);
});
}
</script>
推荐答案
( function (){
debugger ;
.ajax({
类型:' post',
url:' WebServices / DataLoading.asmx / GetAllExhibitionList',
data:{},
contentType:' application:JSON; charset:UTF-8',
成功:OnSuccess,
失败: function (响应){
alert(response.d);
},
错误:功能(响应){
alert(response.d);
}
});
});
function OnSuccess(响应){
.ajax({ type: 'post', url: 'WebServices/DataLoading.asmx/GetAllExhibitionList', data: {}, contentType: 'application:JSON;charset:UTF-8', success: OnSuccess, failure: function (response) { alert(response.d); }, error: function (response) { alert(response.d); } }); }); function OnSuccess(response) {
( [id * = dlallexhibitation])。attr( border, 1);
var xmlDoc =
("[id*=dlallexhibitation]").attr("border", "1"); var xmlDoc =
这篇关于从Webservice返回DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文