web.config
<connectionStrings>
<add name="db1ConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data\Kwan_db1.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
程序中的代码
protected bool isName(){
bool blIsName = false;
string sqlSel = "select count(*) from Kwan_CyBm where userName='" + txtName.Text + "'";
OleDbConnection con = new OleDbConnection();
con.Open();
OleDbCommand com = new OleDbCommand(sqlSel, con);
if (Convert.ToInt32(com.ExecuteScalar()) > 0)
{
blIsName = true;
}
else
{
blIsName = false;
}
return blIsName;
}