标题:System.Web.UI.Page.Server 是属性,此处应为类????接口中
取消只看楼主
guming
Rank: 4
等 级:业余侠客
威 望:5
帖 子:329
专家分:277
注 册:2006-11-9
结帖率:50%
 问题点数:0 回复次数:0 
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]]
搜索更多相关主题的帖子: 接口 Server System Page Web 
2008-01-09 15:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-196690-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.090331 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved