*SellerListingLookupのサンプルコード(VB.NET) [#g8950487] ここで紹介しているコードは[[こちらのプロキシクラス>../../../ProxyClass]]を使用しています。 ここで紹介しているコードは[[こちらのC#のコード>../../CS/SellerListingLookup]]をVB.NETに変換したものです。 Amazon以外の出品者が出品している商品の情報を表示するサンプルです。TextBoxに出品者のIDと商品のExchangeIDを入力します。 #code(vbnet){{ <%@ Page Language="VB" %> <%@ Import Namespace="Amazon.jp.v20060913" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, _ ByVal e As EventArgs) Dim req As New SellerListingLookupRequest() 'Seller IDを指定する req.SellerId = TextBox1.Text '商品のID 'req.IdType = SellerListingLookupRequestIdType.Exchange; req.Id = TextBox2.Text Dim sll As New SellerListingLookup() 'あなたのAccess Key ID sll.AWSAccessKeyId = "(あなたのAccessKeyID)" 'あなたのAssociate ID sll.AssociateTag = "dobonnet-22" sll.Request = New SellerListingLookupRequest() {req} Dim aws As New AWSECommerceService() Dim res As SellerListingLookupResponse Try 'SellerListingLookupオペレーションを実行し、結果を取得 res = aws.SellerListingLookup(sll) Catch ex As Exception Label1.Text = "エラー:" + Server.HtmlEncode(ex.Message) Return End Try If res Is Nothing OrElse res.SellerListings Is Nothing Then Label1.Text = "結果を取得できませんでした。" Return End If If Not (res.SellerListings(0).Request.Errors Is Nothing) Then Label1.Text = "エラー:" + _ res.SellerListings(0).Request.Errors(0).Message Return End If If res.SellerListings(0).SellerListing Is Nothing Then Label1.Text = _ "該当するSellerのリストが見つかりませんでした。" Return End If '結果の表示 Label1.Text = "" Label1.Text += "<ul>" + vbLf Dim sl As SellerListing For Each sl In res.SellerListings(0).SellerListing Label1.Text += "<li><b>" + sl.Title + "</b><br />" + vbLf Label1.Text += "出品者 : " + sl.Seller.Nickname + _ "<br />" + vbLf Label1.Text += "価格 : " + sl.Price.FormattedPrice + _ "<br />" + vbLf Label1.Text += "コンディション : " + sl.Condition + _ "<br />" + vbLf Label1.Text += "サブコンディション : " + sl.SubCondition + _ "<br />" + vbLf Next sl Label1.Text += "</ul>" + vbLf End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Amazonマーケットプレイスの商品情報の取得</title> </head> <body> <form id="form1" runat="server"> <div> <label for="TextBox1">出品者のID : </label> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <br /> <label for="TextBox2">ExchangeID : </label> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <br /> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="送信" /> <br /> </div> </form> <br /> <asp:Label ID="Label1" runat="server" EnableViewState="False"> </asp:Label> </body> </html> }} //これより下は編集しないでください #pageinfo(,2006-10-20 (金) 01:12:00,DOBON!,2006-10-20 (金) 02:19:35,DOBON!) #pageinfo([[:Category/.NET]] [[:Category/ASP.NET]],2006-10-20 (金) 01:12:00,DOBON!,2006-10-20 (金) 02:19:35,DOBON!) |