日期:2014-05-17 浏览次数:20947 次
//刷卡时在数据库的充值卡表里的资料放入LISTBOX控件中,包括卡号和卡余额
private void t_czkh_TextChanged(object sender, EventArgs e)
{
if (t_czkh.Text.Length == 27)
{
shared_card = t_czkh.Text;
string shared_sql = "select * from storevaulecard_data
where storevaluecard_cardid = '" + shared_card + "'";
SqlConnection conn = new SqlConnection(fee_conn.sql_conn());
SqlCommand cmd = new SqlCommand(shared_sql, conn);
conn.Open();
SqlDataReader rs = cmd.ExecuteReader();
if (rs.Read())
{
shared_card_je = Convert.ToInt32(rs["storevaluecard_Balance"]);
shared_type = Convert.ToString(rs["storevaluecard_type"]);
l_cardshare_list.Items.Add(shared_type + ":" + t_czkh.Text.Substring(0, 10) +
" 卡余额:" + (shared_card_je));
}
else
{
MessageBox.Show("不是有效消费卡", "提示");
t_czkh.Text = "";
return;
}
}
}