こんにちは再び最愛の専門家、私のeコマースサイトはもう
を価格が表示されていない私は、サイトがバックエンドデータベースとしてAccessを使用して非常によく働いていたhttp://www.millenniumhealthproducts.com
でのeコマースサイトを持っています。 最近、ホスティング会社をgodaddy.comに変更しました。
データをAccessからSQL Serverデータベースに移行しましたが、もちろん接続文字列をSQL Serverデータベースに変更しました。
これ以降、サイトの価格は0.00と表示されます。
私はこれを引き起こしているのを理解できません。
フィールド名はcpriceです。 Accessデータベースでは、データ型は通貨で、SQL ServerではMoneyです。
私が気づいた奇妙なことは、SQL Serverのdbでは、値がxx.xxxxに似ていることです。アクセスデシベルに
例299.0000しばらく、値がより$ 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)[email protected]));
GO
SQLサーバーでは、データ型とは何ですか?お金?データがバインドされている場所でコードを提供する方がよい。 –
私の最初の推測は、データ型の違いにあります。おそらくあなたのコードのどこかで価格を扱っているので、デフォルトの0の値が取られて使用されます。 – Kitsune
迅速な対応をお寄せいただきありがとうございます。私は上記のコードを投稿しました。 –