首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web Service >

wince开发,无法从传输连接中读取数据。该如何处理

2013-01-25 
wince开发,无法从传输连接中读取数据。本帖最后由 unbachone 于 2012-07-11 13:38:22 编辑开发摩托罗拉MC31

wince开发,无法从传输连接中读取数据。
本帖最后由 unbachone 于 2012-07-11 13:38:22 编辑 开发摩托罗拉MC3190移动终端扫描设备,把设备连到电脑上调试,一切正常,把设备拔下来用无线,就提示无法从传输连接中读取数据。
具体是要把传过来的DataSet放到窗体上的DataGrid里。

补充:我又试了一下,如果传的DataSet是一行,就没有问题。两行,也没问题。行多了,就又问题了,该怎么设置呢?


WebService端是这样的

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.OracleClient;
using PobaService.ServiceReference1;

namespace PobaService
{
    /// <summary>
    /// Service1 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {
        static string connStr = "Data Source=192.168.100.1/orcl10G;user=mis;password=mis";
        OracleConnection oc = new OracleConnection(connStr);

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public DataSet QuerySql(String sqlStr)
        {
            try
            {
                DataSet ds = new DataSet();
                OracleDataAdapter oda = new OracleDataAdapter(sqlStr, oc);
                oda.Fill(ds);
                return ds;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }
    }
}

窗体是这样的
using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;


using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WZCS.WebReference;

namespace WZCS
{
    public partial class MatInvForm : Form
    {
        Service1 dbsvs new Service1();
        Form thatform;
        DataSet ds;
        public MatInvForm(Form thatform)
        {
            this.thatform = thatform;
            InitializeComponent(); 
        }

        private void MatInv_Load(object sender, EventArgs e)
        {
            ds = dbsvs.QuerySql("select t.cknum, t.ckname, t.matid, t.matcode, t.matname, t.specname, t.stuffname, t.countunit, t.invqty from (select t.cknum, t.ckname, t.matid, t.matcode, t.matname, t.specname, t.stuffname, t.countunit, t.invqty, rownum rn from VW_WZCS_MATINV t where rownum >= 1) t where rn <= 5");
            dgMatInv.DataSource = ds.Tables[0];
        }
    }
}



环境是IIS 7.5 在本机上 谢谢
[解决办法]
无法从传输连接中读取数据。

是相关连接的问题,跟读取到数据之后异常是两回事。
换成无线后,无线连接是否能正常连到数据库。

热点排行