以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]求助于狐爸啊,还是读卡写卡的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=30698) |
-- 作者:fjt4444 -- 发布时间:2013/4/2 11:22:00 -- [求助]求助于狐爸啊,还是读卡写卡的问题 真心感谢狐爸帮忙将全局代码搞定,但目前急于测试是否能调用。所以我不得不再贴上一段C#的write和read代码。麻烦狐爸看看,然后帮忙转换一下。万分感谢! 写卡: protected void btnxieka_Click(object sender, EventArgs e) { if (Xieka()) { myLib.PublicModule.Javascript.AlertAndRedirect("写卡成功!", "CardList2.aspx"); } else { myLib.PublicModule.Javascript.Alert("写入失败!", true); return; } } private bool Xieka() { //写入磁卡的内容(业主ID,业主姓名,卡号,卡号ID) string ownerid = this.txtOwnerID.Value; string cardnumber = this.txtCardNumber.Text; string cardguid = this.ViewStateCardGuid; string key = ownerid + "," + cardnumber + "," + cardguid; bool b = DUKa.WriteIn(key); return b; } 读卡: private void Button3_Click(object sender, EventArgs e) { try { string msg = ""; bool b = DUKa.ReadCard("", out msg);//D8读卡 if (b) { string[] cardlist = msg.Split(\',\');//三个参数:业主id,卡号,卡号id DataTable dtable = new DataTable(); dtable = bll.GetOwnerInfo(Convert.ToInt32(cardlist[0])); if (dtable != null) { this.txtCardNumber.Text = cardlist[1].ToString(); this.txtOwnerName.Text = dtable.Rows[0]["OwnerName"].ToString(); this.cardid = Convert.ToInt32(cardlist[2].ToString()); this.ownerid = Convert.ToInt32(cardlist[0].ToString()); } } else { MessageBox.Show("读卡失败"); } } catch { MessageBox.Show("读卡失败"); } }
|
-- 作者:狐狸爸爸 -- 发布时间:2013/4/2 11:42:00 -- Protected Sub btnxieka_Click(sender As Object, e As EventArgs)
Private Sub Button3_Click(sender As Object, e As EventArgs) Dim dtable As New DataTable()
|
-- 作者:fjt4444 -- 发布时间:2013/4/2 11:45:00 -- 谢谢狐爸。 先谢谢狐爸了!我先试试 |