当前位置: 代码迷 >> ASP.NET >> 出现异常提示 应输入类型、命名空间定义或文件尾!
  详细解决方案

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

热度:10258   发布时间:2013-02-25 00:00:00.0
出现错误提示 应输入类型、命名空间定义或文件尾!求救,急!
我的代码是这样的:

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);
  相关解决方案