如何从asp上的Web服务获取数据。网页 [英] How to get data from Web-Service on asp. net page

查看:93
本文介绍了如何从asp上的Web服务获取数据。网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,您好。

请帮帮我。

i有一个Web服务,执行存储过程,并返回数据集:

Hello, friends.
Please help me.
i have a web service, that execute stored procedure, and return data set:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;
using System.Xml;


namespace usingparameterwebservice
{
    /// <summary>
    /// Summary description for mywebservice
    /// </summary>
    [WebService(Namespace = "create_request")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        string constring = WebConfigurationManager.ConnectionStrings["Name"].ToString();
        SqlConnection conn;
        SqlCommand comm;

 [WebMethod(Description = "Просмотр заявки")]
        public DataSet Select(string Reques_id, string nameproc)
        {

            SqlConnection myConn = new SqlConnection(constring);
            SqlDataAdapter myData = new SqlDataAdapter(nameproc, myConn);
            myData.SelectCommand.CommandType = CommandType.StoredProcedure;
            myData.SelectCommand.Parameters.Add(new SqlParameter("@id", SqlDbType.Char, 5));
            myData.SelectCommand.Parameters["@id"].Value = Reques_id;


            DataSet ds = new DataSet();
            myData.Fill(ds);

            return ds;
           }
    }
}





存储过程做简单选择



我需要做一个aspx页面,其中一个表格包含来自存储过程的数据。

如何在Web上以普通视图调用Web服务并检索数据-service。



请帮帮忙!



The stored procedure do simple select

I need to do a aspx page, where will be a table with data from stored procedure.
How to call web service and retrieve data in normal view from web-service.

Please help!

推荐答案

看一下以下链接,希望对您有所帮助:

aspnet-web-service - 或创造和消费 [ ^ ]

在ASP.Net中创建和使用Web服务 [ ^ ]
Take a look at following links, hope it helps you:
aspnet-web-service-or-creating-and-consuming[^]
Creating and Using web service in ASP.Net[^]


这篇关于如何从asp上的Web服务获取数据。网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆