方法如下:

 1.int代表整形。

 2.string 代表 字符型。

3.datetime ,日期类型判断如下

  if(account.date!=Datetime.MinValue)

   {

  Str1.Append("date=' "+account.date+" ', ")

}

   public int Update(AccountInfo account)
{
StringBuilder str1=new StringBuilder();
StringBuilder str2=new StringBuilder(); // int
if( account.number!=)
{
str1.Append("Number="+account.number",")
}else
{
str1.Append(" Number=null , ");
} //string
if(account.Name!=null&&account.Name!="")
{
str1.Append("Name=' " + account.Name+ " ' ,");
}else
{
str1.Append(" Name=' ' , ");
} str2.Append(" update table set ");
str2.Append(str1.ToString().Remove(str1.Length-));
str2.Append(" where ID="+ Account.ID+"");
return SqlHelper.ExecuteSql(str2.ToString); }

当需要向数据库插入空值时,sql语句的判断的更多相关文章

  1. Mysql中Innodb大量插入数据时SQL语句的优化

    innodb优化后,29小时入库1300万条数据 参考:http://blog.51yip.com/mysql/1369.html 对于Myisam类型的表,可以通过以下方式快速的导入大量的数据: A ...

  2. Mysql大量插入数据时SQL语句的优化

    1) 对于Myisam类型的表,可以通过以下方式快速的导入大量的数据.     ALTER TABLE tblname DISABLE KEYS;    loading the data    ALT ...

  3. mybatis 需要注意的点 MyBatis 插入空值时,需要指定JdbcType (201

    转自:https://blog.csdn.net/snakemoving/article/details/76052875 前天遇到一个问题 异常显示如下: 引用 Exception in threa ...

  4. SQL Server数据库性能优化之SQL语句篇【转】

    SQL Server数据库性能优化之SQL语句篇http://www.blogjava.net/allen-zhe/archive/2010/07/23/326927.html 近期项目需要, 做了一 ...

  5. 如何找出MySQL数据库中的低效SQL语句

    面对业务的迅猛发展,DBA的一项重要工作就是及时发现数据库中的低效SQL语句,有的可以立刻着手解决(比如缺少合适的索引),有的需要尽快反馈给开发人员进行修改. MySQL数据库有几个配置选项可以帮助我 ...

  6. DBA 需要知道N种对数据库性能的监控SQL语句

    --DBA 需要知道N种对数据库性能的监控SQL语句 -- IO问题的SQL内部分析 下面的DMV查询可以来检查当前所有的等待累积值. Select wait_type, waiting_tasks_ ...

  7. 【黑马Android】(04)数据库的创建和sql语句增删改查/LinearLayout展示列表数据/ListView的使用和BaseAdater/内容提供者创建

    数据库的创建和sql语句增删改查 1. 载入驱动. 2. 连接数据库. 3. 操作数据库. 创建表: create table person( _id integer primary key, nam ...

  8. 创建数据库和表的SQL语句【转】

    创建数据库和表的SQL语句 转至http://www.cnblogs.com/philanthr/archive/2011/08/09/2132398.html 创建数据库的SQL语句: 1 crea ...

  9. Oracle数据库中,在SQL语句中连接字符串的方法是哪个?(选择1项)

    Oracle数据库中,在SQL语句中连接字符串的方法是哪个?(选择1项) A.cat B.concat C.join D.+ 解答:B

随机推荐

  1. 老马Repository模式原文

    A system with a complex domain model often benefits from a layer, such as the one provided by Data M ...

  2. Django 1.11 release note简明解读

    1.首先1.11这个版本是一个LTS版本 2.第一个支持python3.6的版本,最后一个支持python2.*的版本 3.Deprecating warnings 默认不再显示,同时建议第三方包开始 ...

  3. SQLServer2PostgreSQL迁移过程中的几个问题

    1.PostgreSQL 跨平台迁移工具Migration Toolkit的使用指南:http://www.enterprisedb.com/docs/en/8.4/mtkguide/Table%20 ...

  4. longestCommonPrefix

    Description: Write a function to find the longest common prefix string amongst an array of strings. ...

  5. 让 Homebrew 走代理更新 + brew 管理 node 版本

    0.前言 环境:MacOS 背景:整理下今天所做的配置. 1. 让 Homebrew 走代理更新 brew update 就卡住了,即使开了 shadowsocks 也不行.因为 shadowsock ...

  6. 适合Python的5大练手项目, 你练了么?

    在练手项目的选择上,还存在疑问?不知道要从哪种项目先下手? 首先有两点建议: 最好不要写太应用的程序练手,要思考什么更像是知识,老只会写写爬虫是无用的,但是完全不写也不行. 对于练手的程序,要注意简化 ...

  7. ArcCore重构-Platform_Types.h实现辨析

    AUTOSAR定义了一系列PlatformTypes,如uint8/uint16/uint32等等基本类型. It contains all platform dependent types and ...

  8. HTML学习笔记6:列表标签

    列表标签     什么是列表标签呢? 以平台区分有什么游戏? 手游 pc游戏 家用机游戏 掌机游戏 以游戏类型区分有什么游戏? RPG ARPG MMORPG ACT FPS 以上两种就是一种列表标签 ...

  9. NIO之FileChannel类的理解和使用

    文章链接:http://blog.csdn.net/qq_16628781/article/details/70532307 知识点: FileChannel类及方法理解: 普通输入输出流复制文件: ...

  10. Python报错:SyntaxError: Non-ASCII character '\xe5' in file 1.py on line 6, but no encoding declared...

    本文由荒原之梦原创,原文链接:http://zhaokaifeng.com/?p=686 具体报错内容: File "1.py", line 6 SyntaxError: Non- ...