我的电子商务网站不再显示价格
亲爱的专家们,您好,
我有一个电子商务网站 http://www.millenniumhealthproducts.com
该网站运行良好很好地使用Access作为后端数据库。 最近,我们将托管公司更改为 godaddy.com。
我们将数据从 Access 迁移到 SQL Server 数据库,当然还更改了连接字符串以指向 SQL Server 数据库。
从那时起,该网站现在将价格显示为 0.00。
我不知道是什么原因造成的。
字段名称是 cprice。在 Access db 上,数据类型是“货币”,在 SQL Server 上,数据类型是“货币”。
我注意到的一件奇怪的事情是,在 SQL Server 数据库上,该值更像 xx.xxxx。
示例 299.0000 在 Access db 上时,该值更像 $299.00
有人可以建议如何解决此问题吗?
更改连接字符串可能与此有关吗?
如果需要,我可以提供一些示例 asp 代码。我正在使用经典的asp。
'Response.Buffer = true
Dim catid, strcat
catid = Request.QueryString("id")
strcat = Request.QueryString ("cat")
If catid = "" OR (IsNumeric(catid) = false) Then
Response.Redirect "index.asp"
End if
Dim catname, productslist
sub productInfo(connObj,category)
q = chr(34)
set cmd = server.CreateObject("ADODB.Command")
cmd.ActiveConnection = connObj
cmd.CommandText = "qryProdsCategory"
cmd.CommandType = adCmdStoredProc
set param = cmd.CreateParameter("theCategory",adInteger,adParamInput,4)
cmd.Parameters.Append(param)
cmd("theCategory") = Cint(category)
set rs = server.CreateObject("ADODB.Recordset")
set rs = cmd.Execute
if not rs.EOF then
catname = rs("catdescription")
%>
<table width='100%' border=0 cellspacing=0 cellpadding=0>
<tr>
<%
i = 1
while not rs.EOF
id = RS("catalogID")
'Response.write id
'response.end
%>
<td class=bodytextcolor width='33%' align=center nowrap>
<img src="img/small/<%=rs("cimageurl")%>" align="center" WIDTH='97' HEIGHT='125'>
<br/><%=rs("cname")%>
<br>Regular Price: <font color=red><%= FormatCurrency(rs("cprice"),2) %></font>
<br/><font color=green>10 or more:</font>
<font color=red><%=FormatCurrency(rs("cover10price"),2)%></font>
<br/><font size=-1><a href="product.asp?id=<%=id%>">View Details</a></font>
<br/>
<font face="Verdana">
<form name="_xclick" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="<%=rs("cname")%>">
<input type="hidden" name="amount" value="<%= FormatCurrency(rs("cprice"),2) %>">
<table>
<tr>
<td>Quantity: <input maxLength="6" Name="quantity" size=2 value="1" style="height: 2.2em; border: 1px solid Black; background: ButtonFace;">
<input type="image" src="images/button_in_cart.jpg" border="0" name="submit" alt="PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></td>
</tr>
</table>
<input type="hidden" name="add" value="1">
</form></td>
<%
if (i mod 3) = 0 then
Response.write "</td></tr>"
end if
i = i + 1
rs.MoveNext
wend
else
Response.write "Product information not found."
catname = "Error"
end if
Response.write "productslist: "
rs.Close
set rs = nothing
set cmd = nothing
end sub
%>
--stored procedure
USE [scartmil]
GO
/****** Object: StoredProcedure [dbo].[qryProdsCategory] Script Date: 02/12/2012 19:08:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: StoredProcedure [dbo].[NewStoredProcedure] Script Date: 02/10/2012 19:36:49 ******/
ALTER PROCEDURE [dbo].[qryProdsCategory](@theCategory int)
AS
SELECT products.*, products.ccategory, categories.catdescription
FROM categories INNER JOIN products ON categories.categoryID = products.ccategory
WHERE (((products.ccategory)=@theCategory));
GO
Hello again dearest Experts,
I have an ecommerce site at http://www.millenniumhealthproducts.com
The site was working very well using Access as backend database.
Recently, we changed hosting company to godaddy.com.
We migrated the data from Access to SQL Server database and of course changed connection string to point to SQL Server db.
Since then, the site now display price as 0.00.
I can't figure out what is causing this.
The fieldname is cprice. On Access db, the datatype is Currency and on SQL Server, it is Money.
What one strange thing that I noticed is that on the SQL Server db, the value is more like xx.xxxx.
Example 299.0000 while on Access db, the value is more like $299.00
Can someone please suggest how to fix this?
Could changing connection strings have anything to do with it?
I can provide some sample asp code if requested. I am using classic asp.
'Response.Buffer = true
Dim catid, strcat
catid = Request.QueryString("id")
strcat = Request.QueryString ("cat")
If catid = "" OR (IsNumeric(catid) = false) Then
Response.Redirect "index.asp"
End if
Dim catname, productslist
sub productInfo(connObj,category)
q = chr(34)
set cmd = server.CreateObject("ADODB.Command")
cmd.ActiveConnection = connObj
cmd.CommandText = "qryProdsCategory"
cmd.CommandType = adCmdStoredProc
set param = cmd.CreateParameter("theCategory",adInteger,adParamInput,4)
cmd.Parameters.Append(param)
cmd("theCategory") = Cint(category)
set rs = server.CreateObject("ADODB.Recordset")
set rs = cmd.Execute
if not rs.EOF then
catname = rs("catdescription")
%>
<table width='100%' border=0 cellspacing=0 cellpadding=0>
<tr>
<%
i = 1
while not rs.EOF
id = RS("catalogID")
'Response.write id
'response.end
%>
<td class=bodytextcolor width='33%' align=center nowrap>
<img src="img/small/<%=rs("cimageurl")%>" align="center" WIDTH='97' HEIGHT='125'>
<br/><%=rs("cname")%>
<br>Regular Price: <font color=red><%= FormatCurrency(rs("cprice"),2) %></font>
<br/><font color=green>10 or more:</font>
<font color=red><%=FormatCurrency(rs("cover10price"),2)%></font>
<br/><font size=-1><a href="product.asp?id=<%=id%>">View Details</a></font>
<br/>
<font face="Verdana">
<form name="_xclick" target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="<%=rs("cname")%>">
<input type="hidden" name="amount" value="<%= FormatCurrency(rs("cprice"),2) %>">
<table>
<tr>
<td>Quantity: <input maxLength="6" Name="quantity" size=2 value="1" style="height: 2.2em; border: 1px solid Black; background: ButtonFace;">
<input type="image" src="images/button_in_cart.jpg" border="0" name="submit" alt="PayPal">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></td>
</tr>
</table>
<input type="hidden" name="add" value="1">
</form></td>
<%
if (i mod 3) = 0 then
Response.write "</td></tr>"
end if
i = i + 1
rs.MoveNext
wend
else
Response.write "Product information not found."
catname = "Error"
end if
Response.write "productslist: "
rs.Close
set rs = nothing
set cmd = nothing
end sub
%>
--stored procedure
USE [scartmil]
GO
/****** Object: StoredProcedure [dbo].[qryProdsCategory] Script Date: 02/12/2012 19:08:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object: StoredProcedure [dbo].[NewStoredProcedure] Script Date: 02/10/2012 19:36:49 ******/
ALTER PROCEDURE [dbo].[qryProdsCategory](@theCategory int)
AS
SELECT products.*, products.ccategory, categories.catdescription
FROM categories INNER JOIN products ON categories.categoryID = products.ccategory
WHERE (((products.ccategory)=@theCategory));
GO
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 Access 迁移到 SQL 时,您会遇到许多转换问题,我相信您的问题出在迁移级别,SQL 中的字段可能是
money
或numeric(18,2)< /code>,您可能必须重新迁移它,或者查看如果更改字段的数据类型,SQL 是否会保留这些值。
另外,请确保所有 IDENTITY 数据类型也在 SQL 中配置,至少从经验来看,Access to SQL 并没有真正很好地处理这个问题。
When migrating from Access to SQL you face a number of conversion issue's, i believe your issue is at the migration level and the field in SQL would either be
money
ornumeric(18,2)
, you may have to either remigrate it or see if SQL will keep the values if you change the datatype of field.Also, make sure any IDENTITY datatypes are also configured in SQL, Access to SQL doesn't really take care of this too well, from experience at least.