文本框匹配条件显示结果 [英] text box matches the Condition Shows result

查看:91
本文介绍了文本框匹配条件显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带PinCode的文本框我想要的是当pin代码正确时它会显示我的地址。我可以在按钮的帮助下完成它。但我想在没有按钮的情况下这样做。我在购物网站上看过这个。我对此没有任何想法,这就是我没有放任何代码的原因。

解决方案

双击你的密码文本框,然后输入以下代码: - < br $> b $ b

 受保护  void  Pin_Code_TextChanged( object  sender,EventArgs e)
{
if ( Pin_Code.Text.Length == 5
{
SqlCommand cmd = new SqlCommand( 从Customer_Master中选择*,其中CustomerCode = + Pin_Code.Text,con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.ExecuteNonQuery();
con.Close();
DataSet ds = new DataSet();
da.Fill(ds);
Consignor_Code.Text = ds.Tables [ 0 ]。行[ 3 ] [ 1 ]的ToString();
Consignor_Name.Text = ds.Tables [ 0 ]。行[ 4 ] [ 2 ]的ToString();
Consignor_Address.Text = ds.Tables [ 0 ]。行[ 0 ] [ 3 ]的ToString();
Pin_Code.Text = ds.Tables [ 0 ]。行[ 0 ] [ 4 ]的ToString();
City.Text = ds.Tables [ 0 ]。行[ 0 ] [ 5 ]的ToString();
State.Text = ds.Tables [ 0 ]。行[ 0 ] [ 6 ]的ToString();
Phone.Text = ds.Tables [ 0 ]。行[ 0 ] [ 7 ]的ToString();
Email_id.Text = ds.Tables [ 0 ]。行[ 0 ] [ 8 ]的ToString();
}
}



你可以删除按钮..

我希望这会对你有帮助..


I have A textbox with PinCode I want is when the pin Code is correct it shows me the address.I am able to do it with the help of button.but I want to Do it without button . I have Seen this in shopping websites. I am not having any idea about this that is why I am not putting any Code.

解决方案

Double click on your pin code textBox, and type this code:-

protected void Pin_Code_TextChanged(object sender, EventArgs e)
        {
            if (Pin_Code.Text.Length == 5)
            {
               SqlCommand cmd = new SqlCommand("select * from Customer_Master where CustomerCode=" + Pin_Code.Text, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.ExecuteNonQuery();
con.Close();
DataSet ds = new DataSet();
da.Fill(ds);
Consignor_Code.Text = ds.Tables[0].Rows[3][1].ToString();
Consignor_Name.Text = ds.Tables[0].Rows[4][2].ToString();
Consignor_Address.Text = ds.Tables[0].Rows[0][3].ToString();
Pin_Code.Text = ds.Tables[0].Rows[0][4].ToString();
City.Text = ds.Tables[0].Rows[0][5].ToString();
State.Text = ds.Tables[0].Rows[0][6].ToString();
Phone.Text = ds.Tables[0].Rows[0][7].ToString();
Email_id.Text = ds.Tables[0].Rows[0][8].ToString();
            }
        }


You can remove the button..
I hope this will help you..


这篇关于文本框匹配条件显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆