2012年6月11日

Trengo Code Note

   
  1. 字串比對
    groupName == "ansvalue"
    ↓↓↓
    groupName.Equals("ansvalue", StringComparison.CurrentCultureIgnoreCase)
  2. SQL指令 join
  3. string strValue = "(@AnalysisVarID,@AnalysisGroupID,@GroupCode{0},@GroupValue{0})";
    ...
    DbCommand cmd = db.GetSqlStringCommand("INSERT INTO AnalysisGroupCode Values" + string.Join(",", lstValue.ToArray()) +";");
  4. TransactionScope
    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
    {
    ...
    }
  5. Trim()
  6. IDataReader
    using (IDataReader reader = db.ExecuteReader(cmd))
    {
      if(...)
      {
        admin.ID = (reader.IsDBNull(0) ? 0 : reader.GetInt32(0));
        ...
       }
    }

沒有留言:

張貼留言