以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 XML 与 数据库 』 (http://bbs.xml.org.cn/list.asp?boardid=17) ---- XML格式存储中文字符到数据库出错 !高手来帮帮![求助] (http://bbs.xml.org.cn/dispbbs.asp?boardid=17&rootid=&id=38910) |
-- 作者:llnwzw -- 发布时间:10/15/2006 12:31:00 AM -- XML格式存储中文字符到数据库出错 !高手来帮帮![求助] 我做了个 商务网站 在购物车模块的 定单信息存储到数据库时我是用XML格式存储用户定单信息的 但是发现用户输入的是中文的话 在点击提交后 存储数据就出错了 英文和数字字符就没有问题! 不知道是什么原因 希望高手来帮帮!谢谢 |
-- 作者:llnwzw -- 发布时间:10/15/2006 12:35:00 AM -- 我是用C#/ASP。net做的网站 ! |
-- 作者:llnwzw -- 发布时间:10/15/2006 12:48:00 AM -- using System; using System.Data; using System.Data.SqlClient; using System.Diagnostics; namespace digitalshop.Components { /// <summary> SqlParameter[] prams = { data.MakeInParam("@userid", SqlDbType.VarChar, 80, userid) }; /// <summary> // create data object and params SqlParameter[] prams = { try { // if the order status is an empty string, then the lookup failed |
-- 作者:llnwzw -- 发布时间:10/15/2006 12:49:00 AM -- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Diagnostics; using digitalshop.Components; namespace digitalshop.Web { public OrderProcess() { private void Page_Load(object sender, System.EventArgs e) { // determine who is logged in // add order to database // clear shopping cart // add order to database // create xml doc to pass down to stored proc, this xml doc contains // add this order to the database, get the new order id back // returns the attriubutes for the Orders xml section ShoppingCart cart = (ShoppingCart)Session["ShoppingCartSession"]; // total price // create attribute string return xml; private void Page_Init(object sender, EventArgs e) { #region Web Form Designer generated code }
这是定单生成的代码! 就是这里出的问题! |
-- 作者:llnwzw -- 发布时间:10/15/2006 12:54:00 AM -- 还有 个数据库的 存储过程 代码如下: exec upOrderAdd @xml DECLARE @idoc int -- xml doc -- parse xml doc -- start transaction, updating three tables -- add new order to Orders table -- check for error IF @CurrentError != 0 -- get new order id -- add line items to LineItem table -- check for error IF @CurrentError != 0 -- add status to OrderStatus table -- check for error IF @CurrentError != 0 -- update inventory -- check for error IF @CurrentError != 0 -- end of transaction SET NOCOUNT OFF -- done with xml doc -- return the new order ERROR_HANDLER: |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
17,027.340ms |