public void Sql数据库插入数据_数字日期() { string SqlInsert = @"insert into Table_C (A,B,C,D) values (@1,@2,@3,@4)"; CJia.DataAdapter sqlAdapter = new CJia.DataAdapter(CJia.DbConfigName.SqlDB.ToString()); object[] SqlParams = new object[] { 11, 22.225, "2012-12-22 12:32:56", "bb" }; int Result = sqlAdapter.Execute(SqlInsert, SqlParams); Assert.AreEqual(1, Result, "插入失败"); }
public void Sql数据库插入数据_仅字符串() { string SqlInsert = @"insert into Table_A (colA,colB,colC,colD,colE) values (@1,@2,@3,@4,@5)"; CJia.DataAdapter sqlAdapter = new CJia.DataAdapter(CJia.DbConfigName.SqlDB.ToString()); object[] SqlParams = new object[] { "11", "22", "aa", "bb", "**" }; int Result = sqlAdapter.Execute(SqlInsert, SqlParams); Assert.AreEqual(1, Result, "插入失败"); }
public void Sql数据库插入数据_数字日期_空值() { string SqlInsert = @"insert into Table_C (A,B,C,D) values (@1,@2,@3,@4)"; CJia.DataAdapter sqlAdapter = new CJia.DataAdapter(CJia.DbConfigName.SqlDB.ToString()); object[] SqlParams = new object[] { DBNull.Value, DBNull.Value, DBNull.Value, "gg" }; int Result = 0; string exMsg = ""; try { Result = sqlAdapter.Execute(SqlInsert, SqlParams); } catch (Exception ex) { exMsg = ex.Message; } Assert.AreEqual(1, Result, exMsg); }