dreamweaver,sql,asp为什么提交表单时不能插入表单里……
<%DimcmdSQLforOrderDimstrCurrentTimeDimstrUsernameIf(CStr(Request("MM_MyOWNforOrder")...
<%
Dim cmdSQLforOrder
Dim strCurrentTime
Dim strUsername
If (CStr(Request("MM_MyOWNforOrder"))<>"")Then
strCurrentTime=Now()
Set cmdSQLforOrder=Server.CreateObject("ADODB.Command")
cmdSQLforOrder.ActiveConnection=MM_cnlzcs58_STRING
strUsername=LTRIM(RTRIM(CStr(Request("hidUsername"))))
cmdSQLforOrder.CommandText="INSERT dbo.Gdingdan SELECT'"+CSTR(strCurrentTime)+strUsername+"',dbo.Fgouwuche.Ausername,dbo.Fgouwuche.DID,dbo.Dshangpin.Dprice,dbo.Fgouwuche.Fnumber,CAST('"+CSTR(strCurrentTime)+"'AS datetime) FROM dbo.Fgouwuche,dbo.Dshangpin WHERE LTRIM(RTRIM(dbo.Fgouwuche.Ausername))=' "+ strUsername+"' AND LTRIM(RTRIM(dbo.Fgouwuche.DID))=LTRIM(RTRIM(dbo.Dshangpin.DID))"
cmdSQLforOrder.Execute
cmdSQLforOrder.CommandText="DELETE FROM dbo.Fgouwuche WHERE LTRIM(RTRIM(Ausername)) ='"+ LTRIM(RTRIM(CStr(Request("hidUsername"))))+"'"
cmdSQLforOrder.Execute
Response.Redirect("dingdanqueren.asp")
End if
%>
这短码检查了好几遍没发现错误,就是提交表单时,相关数据插入不到Gdingdan表里,下面这是Gdingdan表
题目说错了,是不能插入表里…… 展开
Dim cmdSQLforOrder
Dim strCurrentTime
Dim strUsername
If (CStr(Request("MM_MyOWNforOrder"))<>"")Then
strCurrentTime=Now()
Set cmdSQLforOrder=Server.CreateObject("ADODB.Command")
cmdSQLforOrder.ActiveConnection=MM_cnlzcs58_STRING
strUsername=LTRIM(RTRIM(CStr(Request("hidUsername"))))
cmdSQLforOrder.CommandText="INSERT dbo.Gdingdan SELECT'"+CSTR(strCurrentTime)+strUsername+"',dbo.Fgouwuche.Ausername,dbo.Fgouwuche.DID,dbo.Dshangpin.Dprice,dbo.Fgouwuche.Fnumber,CAST('"+CSTR(strCurrentTime)+"'AS datetime) FROM dbo.Fgouwuche,dbo.Dshangpin WHERE LTRIM(RTRIM(dbo.Fgouwuche.Ausername))=' "+ strUsername+"' AND LTRIM(RTRIM(dbo.Fgouwuche.DID))=LTRIM(RTRIM(dbo.Dshangpin.DID))"
cmdSQLforOrder.Execute
cmdSQLforOrder.CommandText="DELETE FROM dbo.Fgouwuche WHERE LTRIM(RTRIM(Ausername)) ='"+ LTRIM(RTRIM(CStr(Request("hidUsername"))))+"'"
cmdSQLforOrder.Execute
Response.Redirect("dingdanqueren.asp")
End if
%>
这短码检查了好几遍没发现错误,就是提交表单时,相关数据插入不到Gdingdan表里,下面这是Gdingdan表
题目说错了,是不能插入表里…… 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询