public String CreateSqlParameter(Boolean output, Boolean useDataObject)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("cmd.Parameters.Add(new SqlParameter(\"@" + column.Name + "\", SqlDbType." + column.SqlType.SqlDbType + ", " + column.Length + ", ParameterDirection.");
            if (output)
            {
                sb.Append("Output");
            }
            else
            {
                sb.Append("Input");
            }
            sb.Append(", false, " + column.Precision + ", " + column.Scale + ", \"" + name + "\", DataRowVersion.Proposed, ");
            if (useDataObject)
            {
                sb.Append(String.Format(property.Type.ConvertToSqlTypeFormat, "data", "data." + Name, "", "", property.GetMethodFormat()));
            }
            else
            {
                sb.Append(String.Format(property.Type.ConvertToSqlTypeFormat, "", property.GetFieldFormat(), "", "", property.GetFieldFormat()));
            }
            sb.Append("));" + Environment.NewLine);
            return(sb.ToString());
        }
Пример #2
0
 /// <summary>
 /// Returns the phrase to use to get the sql format of a type.  Currently
 /// only used with Velocity generator.
 /// </summary>
 /// <param name="field">Field whose sql format is needed.</param>
 /// <returns>String for converting the field to sql format (like artProjectId.DBValue)</returns>
 public String GetSqlConversion(PropertyElement field)
 {
     return(String.Format(field.Type.ConvertToSqlTypeFormat, "", field.GetFieldFormat(), "", "", field.GetFieldFormat()));
 }