• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
缎雨
博客园 首页 新随笔 联系 订阅 订阅 管理

2013年8月13日

Linq-Detach方法--删除对象的时候如有关系导制错误去关系
摘要: public static void Detatch(Object entity) { Type t = entity.GetType(); System.Reflection.PropertyInfo[] properties = t.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); foreach (var property in properties) { string name = property.Name; if (property.Prop 阅读全文
posted @ 2013-08-13 11:47 缎雨 阅读(305) 评论(0) 推荐(0)
 
DatabaseExtensions 扩展方法 查询视图
摘要: using System;using System.Collections;using System.Collections.Generic;using System.Data;using System.Data.Entity;using System.Linq;using System.Reflection;using System.Reflection.Emit;using System.Text;using System.Threading.Tasks; public static class DatabaseExtensions { public static IEnumerable 阅读全文
posted @ 2013-08-13 11:18 缎雨 阅读(340) 评论(0) 推荐(0)
 
在C#中执行带有GO的批量sql语句
摘要: 在C#中执行带有GO的批量sql语句思海网络 出品()在用C#中调用ADO执行批量SQL语句的时候,会出现无法识别GO语句的错误。这个时候,我们以GO语句为分割点,把整个批量语句分割成N块独立的SQL语句代码块(不包含GO语句),然后再顺序执行每一块代码。要是Go很少,可以把整个sql,以go为分割点,拆成N个sql1,sql2,sql3……再用SqlCommand的CommandText=sql1,sql2,sql3……一个个执行!编程实现方法如下:System.Data.SqlClient.SqlCommand sqlCommand = new System.Data.SqlClient. 阅读全文
posted @ 2013-08-13 11:14 缎雨 阅读(1635) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3