首页上一页 1  下一页尾页 1 条记录 1/1页
        AJAX校内数码相册:列名 'Property1' 无效。
                 	
                        发表在ASP.NET图书答疑
                        2011-05-18                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                                           /// <summary>
/// 添加分类
/// </summary>
public int AddCategory(string Cname, string Cstatus)
{
//标识变量
int result = 1;
//创建LINQ查询语句
var results = from v_pc in lqc.Photo_Category
where v_pc.C_Name == Cname
select v_pc;
//判断是否存在同名分类名称
if (results.Count() > 0)
{
result = 0;//说明存在同名分类
}
else//执行添加操作
{
Photo_Category pc = new Photo_Category();
pc.C_Name = Cname;
pc.C_Status = Cstatus;
try
{
//插入信息
lqc.Photo_Category.InsertOnSubmit(pc);
//提交数据库
lqc.SubmitChanges();
                
}
catch (Exception ex)
{
//抛出异常
throw new Exception(ex.Message, ex);
}
}
return result;
}
调试时抛出异常报错,Message:列名 'Property1' 无效。
                
        	
        
        
    /// 添加分类
/// </summary>
public int AddCategory(string Cname, string Cstatus)
{
//标识变量
int result = 1;
//创建LINQ查询语句
var results = from v_pc in lqc.Photo_Category
where v_pc.C_Name == Cname
select v_pc;
//判断是否存在同名分类名称
if (results.Count() > 0)
{
result = 0;//说明存在同名分类
}
else//执行添加操作
{
Photo_Category pc = new Photo_Category();
pc.C_Name = Cname;
pc.C_Status = Cstatus;
try
{
//插入信息
lqc.Photo_Category.InsertOnSubmit(pc);
//提交数据库
lqc.SubmitChanges();
}
catch (Exception ex)
{
//抛出异常
throw new Exception(ex.Message, ex);
}
}
return result;
}
调试时抛出异常报错,Message:列名 'Property1' 无效。

	
                                                
购物车
发表新帖
立即签到
                






