错误 3 “TestDemoWebEmpty.DBHelper.Executesql(string)”是抽象的,但它包含在非抽象类“TestDemoWebEmp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace TestDemoWebEmpty
{
public class DBHelper
{
private static string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["conn"].ToString();
public abstract DataSet Query(string sqlString, SqlParameter[] cmdParms);
public abstract DataSet Query(string sql);
public abstract int Executesql(string sql);
public abstract int ExecuteSqlTran(Hashtable SQLStringList);
}
public partial class FormLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
string msg = Request["msg"];
if (msg != null && msg.Equals("ln"))
{
lblmsg.Text = "请先登录再访问!";
}
}
protected void btnOk_Click(object sender, EventArgs e)
{
//获得用户名密码
string username = txtUsername.Text.Trim();
string password = txtPassword.Text;
string sql = "select * from UserInfo where uname=@uname and pwd=@pwd";
SqlParameter[] parameters ={
new SqlParameter("@uname",SqlDbType.VarChar,50),
new SqlParameter("@pwd",SqlDbType.VarChar,50)
};
parameters[0].Value = username;
parameters[1].Value = password;
DataTable dt = DBHelper.Query(sql, parameters).Tables[0];
//登录成功
if (dt.Rows.Count > 0)
{
string uname = (string)myReader[0];
Session["username"] = username;
Session["password"] = password;
Response.Redirect("Success.aspx");
}
else
{
lblmsg.Text = "对不起您输入的账号或密码错误";
}
}
}
}
错误:错误 3 “TestDemoWebEmpty.DBHelper.Executesql(string)”是抽象的,但它包含在非抽象类“TestDemoWebEmpty.DBHelper”中 C:\Users\leng\Desktop\TestDemoWebEmpty\TestDemoWebEmpty\FormLogin.aspx.cs 19 29 TestDemoWebEmpty
错误 4 “TestDemoWebEmpty.DBHelper.ExecuteSqlTran(System.Collections.Hashtable)”是抽象的,但它包含在非抽象类“TestDemoWebEmpty.DBHelper”中 C:\Users\leng\Desktop\TestDemoWebEmpty\TestDemoWebEmpty\FormLogin.aspx.cs 20 29 TestDemoWebEmpty
错误 2 “TestDemoWebEmpty.DBHelper.Query(string)”是抽象的,但它包含在非抽象类“TestDemoWebEmpty.DBHelper”中 C:\Users\leng\Desktop\TestDemoWebEmpty\TestDemoWebEmpty\FormLogin.aspx.cs 18 33 TestDemoWebEmpty
错误 1 “TestDemoWebEmpty.DBHelper.Query(string, System.Data.SqlClient.SqlParameter[])”是抽象的,但它包含在非抽象类“TestDemoWebEmpty.DBHelper”中 C:\Users\leng\Desktop\TestDemoWebEmpty\TestDemoWebEmpty\FormLogin.aspx.cs 17 33 TestDemoWebEmpty