阅读二代证的WinCE PDA智能设备应用程序

        最近有用VS 2005 .NET Compact Framework 库开发一个PDA智能设备应用程序,该PDA采用WinCE5.0嵌入式操作系统及SQL Server CE 数据库,本程序主要功能是:阅读二代居民身份证信息及保存、打印来访登记信息。

  以下是程序部分截屏:

以下是“登记携带物品”函数实现:

       //登记携带物品
        private void btnDJWP_Click(object sender, EventArgs e)
        {
            string szIDCode = tbIDCode.Text.Trim();
            if (szIDCode == null || szIDCode.Equals(""))
            {
                MessageBox.Show("请先读身份证!");
                return;
            }           

            if (this.connection.State.Equals(ConnectionState.Closed))
                this.connection.Open();

            // Dispose previous SqlCeCommand and previous SqlCeResultSet
            if (null != this.command) this.command.Dispose();

            //Creates a Command with the associated connection           
            this.command = this.connection.CreateCommand();

            SqlCeTransaction tx = this.connection.BeginTransaction();
            this.command.Transaction = tx;

            try
            {
                //保存携带物品
                string szQuery =
                         "INSERT INTO Article " +
                         "( [ArtName], [ArtCount], [ArtDesc], [IDCode], [InTime] ) " +
                         "VALUES( @ArtName, @ArtCount, @ArtDesc, @IDCode, @InTime )";

                this.command.CommandText = szQuery;
                this.command.Parameters.Add("@ArtName", SqlDbType.NVarChar, 20).Value = tbArtName.Text.Trim();
              // 略... ...                
                this.command.ExecuteNonQuery();

                tx.Commit();
                MessageBox.Show("物品登记成功!");

                cbDept.Focus();

            }
            catch (Exception ex)
            {
                tx.Rollback();
                MessageBox.Show("物品登记错误:" + ex.Message);
            }
            finally
            {
                if (this.connection != null && !this.connection.State.Equals(ConnectionState.Closed))
                {
                    this.connection.Close();
                }

            }                
        }

 

 

 

【友情链接 | 橱窗推荐】

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值