首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

出现异常提示 应输入类型、命名空间定义或文件尾!

2012-09-23 
出现错误提示 应输入类型、命名空间定义或文件尾!求救,急!我的代码是这样的:using Systemusing System.Dat

出现错误提示 应输入类型、命名空间定义或文件尾!求救,急!
我的代码是这样的:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

namespace ebusiness.Components
{
  public class Category
  {
  public Category()
  { }
  public DataTable GetCatgories()
  {
  try
  {
  ebusiness.Common.DataAccess DataAs = new ebusiness.Common.DataAccess();
  DataTable DT = DataAs.CreateDataTable("select*from[Categories]");
  return (DT);
  }
  catch (Exception ex)
  {
  ebusiness.Common.SystemError.SystemLog(ex.Message);
  throw new Exception(ex.Message, ex);
  }
  }
  public bool DeleteCategory(int category_id)
  {
  try
  {
  ebusiness.Common.DataAccess DataAs = new ebusiness.Common.DataAccess();
  bool flag = DataAs.ExecSql("delete from [Categories] where category_id =" + category_id);
  return (flag);
  }
  catch (Exception ex)
  {
  ebusiness.Common.SystemError.SystemLog(ex.Message);
  throw new Exception(ex.Message, ex);
  }
  }
  public DataTable GetCategory(string name)
  {
  try
  {
  ebusiness.Common.DataAccess DataAs = new ebusiness.Common.DataAccess();
  string strSQL = "select * from[Categories] where name = '" + name + "'";
  DataTable DT = DataAs.CreateDataTable(strSQL);
  return (DT);
  }
  catch (Exception ex)
  {
  ebusiness.Common.SystemError.SystemLog(ex.Message);
  throw new Exception(ex.Message, ex);
  }
  }
  public bool hasCategory(string name)
  {
  DataTable DT = GetCategory(name);
  if (DT.Rows.Count > 0)
  return true;
  else
  return false;
  }
  public bool AddCategory(string name)
  {
  try
  {
  ebusiness.Common.DataAccess DataAs = new ebusiness.Common.DataAccess();
  bool flag = DataAs.ExecSql("insert into [Categories] values('" + name + "')");
  return (flag);
  }
  catch (Exception ex)
  {
  ebusiness.Common.SystemError.SystemLog(ex.Message);
  throw new Exception(ex.Message, ex);
  }
  }
  public bool UpdateCategroy(int category_id, string name)
  {
  try
  {
  ebusiness.Common.DataAccess DataAs = new ebusiness.Common.DataAccess();
  bool flag = DataAs.ExecSql("update [Categories] set name ='" + name + "'where category_id = " + category_id);
  return (flag);


  }
  catch (Exception ex)
  {
  ebusiness.Common.SystemError.SystemLog(ex.Message);
  throw new Exception(ex.Message, ex);
  }
  }
  }
}
之后就出现那个错误,不知道是什么问题,请哪位大虾救命啊!急!!!!!!

[解决办法]
public Category()
{ }
要输入放回类型的吧 要是没有 改写成
public void Category()
{ }

热点排行