以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  [求助]帮我看看程序,谢了  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=7222)


--  作者:kettychang
--  发布时间:5/5/2004 3:39:00 PM

--  [求助]帮我看看程序,谢了
偶是新手
我想实现插入数据到数据库中的表格supplier(sql server 2000)
我首先在查询分析器中写了:
create proc sp_insert_suppliers @suppliers ntext
as
declare @hDoc int

exec sp_xml_preparedocument @hDoc output,@suppliers

insert into suppliers
select * from openxml(@hDoc,'/Suppliers') with suppliers

exec sp_xml_removedocument @hDoc
然后写了一个htmll文件
<HTML>
<BODY>
<FORM action="http://210.*.*.*/Tradedb/template/supp.xml"
method="post">
  <input type="hidden" id="SUP" name="Suppliers">
  <input type="hidden" name="contenttype" value="text/xml">
  supplier code:<input type=text id="SUPcode" value="1012"><br>
  supplier Name:<input type=text id="SUPname" value="Smith"><br>   
  <input type="submit" onclick="Insert_Employee(SUP,SUPcode,SUPname)"
  value="Insert Employee"><br>

<script language=JScript>
  function Insert_Employee(SUP,SUPcode,SUPname)
    {
     SUP.value='<Suppliers SUPcode="'SUPcode.value+'"SUPname="'+SUPname.value+'"/>';
    }
</script>

</FORM>
</BODY>
</HTML>
这个html文件调用的supp.xsl文件为:
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
  <sql:header>
     <sql:param name='suppliers'><Suppliers/></sql:param>
  </sql:header>
  <sql:query>exec sp_insert_suppliers @suppliers
  </sql:query>
</ROOT>
问题是:记录写不进表格


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
7,032.227ms