public void Insert(IDbConnection cn, YZSoft.Web.BPA.UserPosition userPosition) { using (OracleCommand cmd = new OracleCommand()) { cmd.Connection = cn as OracleConnection; cmd.BindByName = true; StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO BPAUserPosition("); sb.Append("\"UID\","); sb.Append("FileID,"); sb.Append("SpriteID) "); sb.Append("VALUES("); sb.Append(":PM_UID,"); sb.Append(":FileID,"); sb.Append(":SpriteID)"); cmd.CommandText = sb.ToString(); cmd.Parameters.Add(":PM_UID", OracleDbType.NVarchar2).Value = this.Convert(userPosition.UID, false); cmd.Parameters.Add(":FileID", OracleDbType.NVarchar2).Value = this.Convert(userPosition.FileID, false); cmd.Parameters.Add(":SpriteID", OracleDbType.NVarchar2).Value = this.Convert(userPosition.SpriteID, false); cmd.ExecuteNonQuery(); } }
public void Insert(IDbConnection cn, YZSoft.Web.BPA.UserPosition userPosition) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = cn as SqlConnection; StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO BPAUserPosition("); sb.Append("UID,"); sb.Append("FileID,"); sb.Append("SpriteID) "); sb.Append("VALUES("); sb.Append("@UID,"); sb.Append("@FileID,"); sb.Append("@SpriteID)"); cmd.CommandText = sb.ToString(); cmd.Parameters.Add("@UID", SqlDbType.NVarChar).Value = this.Convert(userPosition.UID, false); cmd.Parameters.Add("@FileID", SqlDbType.NVarChar).Value = this.Convert(userPosition.FileID, false); cmd.Parameters.Add("@SpriteID", SqlDbType.NVarChar).Value = this.Convert(userPosition.SpriteID, false); cmd.ExecuteNonQuery(); } }