如何使用数据库字段之一来验证文本框? [英] how to use one of the database field to validate the textbox?
本文介绍了如何使用数据库字段之一来验证文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页面中使用了文本框.
如果我想用数据库中的单词检查输入的单词,我必须检查条件,
textbox1.text ==那个数据库字段" ,然后使用数据列表控件显示另一个db字段.我想知道如何提及该数据库字段"来检查条件,否则还有其他可能性吗?
请帮助我..
I have used a textbox in a page.
if i want to check the typed word with the one in the database, i have to check the condition,
textbox1.text==''that database field'' and then display the other db field using datalist control. i want to know how to mention ''that database field'' to check the condition or else is there any other possibilities?
help me pls..
推荐答案
protected void textbox1_TextChanged(object sender, EventArgs e)
{
Connection cn = new Connection();
string strSql = "select * from [Table]";
DataTable ds = new DataTable();
ds = cn.GetDatanew(strSql);
if (textbox1.Text == ds.Rows[0]["id"].ToString())
{
}
}
这篇关于如何使用数据库字段之一来验证文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文