mysql Sql引數用?而不用@

leelong80發表於2011-06-05

mysql Sql引數用?而不用@

 

 StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into COS_Order(");
            strSql.Append("Ord_DiscountInformation,Ord_Suppliers)");
            strSql.Append(" values (");
            strSql.Append("?Ord_DiscountInformation,?Ord_Suppliers)");
            MySqlParameter[] parameters = {
     new MySqlParameter("?Ord_DiscountInformation", MySqlDbType.VarChar,255),
     new MySqlParameter("?Ord_Suppliers", MySqlDbType.VarChar,255),
            parameters[0].Value = model.Ord_DiscountInformation;
            parameters[1].Value = model.Ord_Suppliers;

相關文章