怎样验证账号是否已经被注册
如题我想知道代码有关怎么写啊
本来这不是很难的问题 但对于我这个初学这来说 很难搞啊~
各位走过的,路过的帮小弟看看吧~ 谢谢啦!
[解决办法]
OleDbConnection conn = null;
OleDbCommand cmd = new OleDbCommand();
public DB()
{
conn = new OleDbConnection(ConfigurationManager.ConnectionStrings[ "dsn "].ConnectionString);
}
public OleDbConnection getConn()
{
if (conn.State == ConnectionState.Closed)
conn.Open();
return conn;
}
public void close()
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
public string exeEx(string strSQL)
{
cmd.Connection = getConn();
cmd.CommandText = strSQL;
string strEx = cmd.ExecuteScalar().ToString();
return strEx;
}
===============================================
DB myDb = new DB()
int i = cint(myDb.exeEx( "select const(*) from 帐户表 where ID = 某帐户 "));
if (i> 0)
{
//帐号已注册
}
else
{
//注册代码块
}