private void txtpwd_TextChanged(object sender, EventArgs e)
{
string a = txtname.Text;
string b = "select Uname from userinfo where Uname =a"; if (a == b)
{
MessageBox.Show("用户名重复");
}
}
这个我的代码。。
我总觉得
b = "select Uname from userinfo where Uname =a";
这有错误。。
怎么能把用户输入的结果 当成 where条件给他。。我其实还想用定义个数组 把select Uname from userinfo的查询结果都放到数组里。。但是 不会定义数组
菜鸟求教。。谢谢了c#,编程,数组,结构,讨论
{
string a = txtname.Text;
string b = "select Uname from userinfo where Uname =a"; if (a == b)
{
MessageBox.Show("用户名重复");
}
}
这个我的代码。。
我总觉得
b = "select Uname from userinfo where Uname =a";
这有错误。。
怎么能把用户输入的结果 当成 where条件给他。。我其实还想用定义个数组 把select Uname from userinfo的查询结果都放到数组里。。但是 不会定义数组
菜鸟求教。。谢谢了c#,编程,数组,结构,讨论
解决方案 »
- SQL2005和MSDE同时存在,比如现在我想用MSDE,如何设置?
- C# GDI+ 绘图 各位速来讨论 在线等你们的意见哦 !
- Dotfuscator混淆C#生成的dll,无法被其他程序集调用
- 用C# 如何做一个声控flash
- 求助:Excel文档为某块区域设置表边框
- 在关新闻生成的SHTML问题!
- 如何得到对方电脑的当前时间??????!!!!!!!
- DataGrid中的checkbox select问题
- 问下,在listview的SubItem里放一个控件怎么弄
- 求用鼠标绘两个矩形并判断两个矩形是否有重叠的方法!可再加一百!
- OData (WCF数据服务) 如何实现多表查询
- OleDbDataReader 提示错误
SqlCommand sqlCommand = ...
sql = "select Uname from userinfo where Uname ='" + a + "'";
string b = sqlCommand.ExecuteScalar(sql, conn).ToString();
...
{
string sql = "SELECT * FROM userinfo WHERE UserName = @UserName "; SqlCommand command = new SqlCommand(sql);
command.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = UserName;
DataTable table = DBProvider.DefaultDBOperator.GetDataTable(command);
if (table.Rows.Count == 0)
{
return true;
}
return false;
}private void txtpwd_TextChanged(object sender, EventArgs e)
{
string a = txtname.Text;
bool blnSameName=CheckSameName(a); if (blnSameName)
{
MessageBox.Show("用户名重复");
}
}
求解看不太懂