mobile 5.0 pocket PC 的第一个demo

昨天公司又决定下一个项目用mobile 5.0 pocket PC中Device Application 做了,没办法。又转向学这个了。OWCC就得暂时停下来了。
晚上和同事完成一个侦察游戏后,开始做第一个mobile 5.0 pocket PC的demo。可是没研究出来。内容很简单。就是在页面上拖一个button,TextBox,DataGrid。点击button把从数据库中查出的数据通过webservice 显示到DataGrid上,我在网上查了一下其他的资料。其中有一点值得注意的是在引用webservice 时的地址不能为localhost而应为自已ip,可是我通过自已的ip可以引用到webservice ,但是运行的时候却是出现错误。运行时错误:storage memory is critically low .if you do mot increase storage memory,you may not be able to start some programs .Use File Explorer to delete files you no longer need ,or move some files to a storage card.
到晚上9点了,还调不出来,没办法了。不调了,今天再去请教高人吧,然后呢,就到今天了。一大早就来当“记录员”。
先把代码贴出来吧。

form里的主要代码:

  private void button1_Click(object sender, EventArgs e)
        {

            Service1 ser = new Service1();
            textBox1.Text = ser.HelloWorld().ToString();
            DataSet ds = new DataSet();
            ds = ser.gettable();
            this.dataGrid1.DataSource = ds.Tables["UserInfo"];

        }
webservice :

 [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public DataSet  gettable()
        {
            SqlConnection conn = new System.Data.SqlClient.SqlConnection("Data Source=YIYISAWA\\SQLEXPRESS;Initial Catalog=pubs;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("select * from UserInfo",conn );
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet ds = new DataSet();

               da.Fill(ds, "UserInfo");
               return ds;
        }
运行却出现错误。

原文地址:https://www.cnblogs.com/yiyisawa/p/1006616.html