System.Web.UI.Page.Server 是属性,此处应为类????接口中
红色部分为错误提示,望各位指教了,谢谢~~~public interface iuser//创建接口,定义公共属性和方法
{
int adduser(string name,string pswd,string age);
int deluser(int uid);
OleDbDataReader login(string logname,string loginpswd);
OleDbDataReader databind();
}
public class user:iuser//继承接口和实现接口中的方法
{
public static readonly string addstr="INSERT INTO userstb([username],[password],[userage]) values";
public static readonly string delstr="DELETE FROM userstb WHERE id=";
public static readonly string loginstr="SELECT username,password FROM userstb WHERE username=";
public static readonly string databindstr="SELECT username,password,userage FROM userstb";
public int adduser(string name,string pswd,string age)
{
OleDbConnection thisCON=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(ConfigurationSettings.AppSettings["datacon"])); //运行时提示server错误:此处应为类,不是属性
OleDbCommand addCOMD=thisCON.CreateCommand();
("+name+","+pswd+","+age+")";
int n;
try
{
thisCON.Open();
n=addCOMD.ExecuteNonQuery();
}
finally
{
thisCON.Close();
}
return n;
}
public int deluser(int uid)
{
OleDbConnection thisCON=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(ConfigurationSettings.AppSettings["datacon"]));//运行时提示server错误:此处应为类,不是属性
OleDbCommand delCOMD=thisCON.CreateCommand();
int K;
try
{
thisCON.Open();
K=delCOMD.ExecuteNonQuery();
}
finally
{
thisCON.Close();
}
return K;
}
public OleDbDataReader login(string logname,string loginpswd)
{
OleDbConnection thisCON=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(ConfigurationSettings.AppSettings["datacon"]));//运行时提示server错误:此处应为类,不是属性
OleDbCommand loginCOMD=thisCON.CreateCommand();
password="+loginpswd;
OleDbDataReader logindr=null;
try
{
thisCON.Open();
logindr=loginCOMD.ExecuteReader();
}
finally
{
thisCON.Close();
}
return logindr;
}
public OleDbDataReader databind()
{
OleDbConnection thisCON=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath(ConfigurationSettings.AppSettings["datacon"]));//运行时提示server错误:此处应为类,不是属性
OleDbCommand bindCOMD=thisCON.CreateCommand();
OleDbDataReader databinddr=null;
try
{
thisCON.Open();
databinddr=bindCOMD.ExecuteReader();
}
finally
{
thisCON.Close();
}
return databinddr;
}
[[italic] 本帖最后由 guming 于 2008-1-9 15:57 编辑 [/italic]]