想请教这段代码有没有错误?
using System;using System.Data.OleDb;
namespace WindowsFormsApplication1
{
class DB
{
public static bool logo(string g, string n, string pwd)
{
String strconnection = "Provider=Microsoft.Jet.OleDb.4.0;";//Data source = |DataDirectory| \\info.mdb:";
strconnection += @"Data Source=|DataDirectory|\info.mdb";
OleDbConnection cn = new OleDbConnection(strconnection);
cn.Open();
OleDbCommand command = new OleDbCommand();
try
{
string sql = "select count(*) from userInfo where(group='" + g + "'and username='" + n + "'and password='" + pwd + "')";
}catch(Exception){
}
int num = 0;
num = (int)command.ExecuteScalar();
cn.Close();
if (num == 1)
return true;
else
return false;
}
}
}