请问下public abstract class SqlHelper抽象类下,为什么能写public static int ExecuteNonQuery()方法呢?
如:
public abstract class SqlHelper
{
//Database connection strings
public static readonly string ConnectionStringLocalTransaction = ConfigurationManager.AppSettings["SQLConnString1"];
public static int ExecuteNonQuery(string connectionString, CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(connectionString))
{
PrepareCommand(cmd, conn, null, cmdType, cmdText, commandParameters);
int val = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
return val;
}
}
}
------解决方案--------------------------------------------------------
一个抽象类可以包含抽象和非抽象方法