额,在这里,我一时不知道怎么说好,好矛盾,因为我还是菜鸟
有个数据库,然后,点击datalist里图片(这个做好了)跳转一个获取ID的页面
然后,里面我想有价格、会员价格、图片、上传时间、放入购物车、加入收藏夹
价格和会员价格我都会了,但是,图片,上传时间(不太会,因为不是绑定一张图片,而是数据库的图片)
放入购物车,加入收藏夹还没做
额,我口水是多了点,因为,我心急,我想说最详细给各位大侠知道
前台:是ASCX文件
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="pd_id.ascx.vb" Inherits="public_pd_id" %>
<style type="text/css">
  .pd_top
  {
  
  }
  #info
  {
  width:600px;
  height:250px;
  float:left;
  clear:both;
  display:block;
  
  }
  .l_info
  {
  float:left;
  width:220px;
  height:200px;
  border-color:Blue;
  border-style:solid;
  border-width:1px;
  margin:5px;
  padding:2px;
  }
  .r_info
  {
  float:right;
  width:370px;
  height:250px;
  margin:5px;
  border-color:red;
  border-style:solid;
  border-width:1px; 
  } 
  #long_info
  {
  width:600px;
  height:500px;
  
  } 
  #info .r_info ul
  {
  float:left;
  list-style:none;
  }
  #info .r_info ul li
  {
  margin:20px 5px;
  padding-top:5px;
  } 
</style>
<div>
<div>
  <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  </div>
<div id="info">
<div class="l_info">  <asp:Image ID="Image1" runat="server" ImageUrl='<%#"~/"+ Eval("smallimg") %>' 
Height="190px" Width="190px"/> </div>
<div class="r_info">
<ul>
<li><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label></li>
<li><asp:Label ID="Label3" runat="server" Text="Label"></asp:Label></li>
<li><asp:Label ID="Label4" runat="server" Text="Label"></asp:Label></li>
<li><asp:Label ID="Label5" runat="server" Text="Label"></asp:Label></li>
</ul>
  </div>
  </div>
<div id="long_info">product information</div>
</div>后台:
Imports System.Data
Imports System.Data.OleDb
Partial Class public_pd_id
  Inherits System.Web.UI.UserControl  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  Dim conn As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("~/data/#book.mdb"))
  Dim strsql As String
  strsql = "select * from book where id=" & Request.QueryString("id")
  Dim cmd As New OleDbCommand(strsql, conn)
  conn.Open()
  Dim dr As OleDbDataReader = cmd.ExecuteReader()
  dr.Read()
  Label1.Text = dr.Item("name")
  Label2.Text = "市场价格" & dr.Item("etprice")
  Label3.Text = "会员价格" & dr.Item("memberprice")
  Image1.DescriptionUrl = dr.Item("bigimg")‘这个DescriptionUrl,我不知道什么的,上网说是绑定图片的,但是好像似乎可能是绑定一张图片的吧’  conn.Close()
  End Sub
End Class
其实,就是绑定的问题,而图片绑定,和时间的绑定都不太懂,谢谢有心人事可以帮忙解答下,关于放入购物车,添加收藏就是插入语句是么?我是菜鸟

解决方案 »

  1.   

    Image 是否在数据绑定控件中,否则不要使用Eval
    Image1.ImageUrl="~"+&dr.Item("bigimg")//图片地址
    Label1.Text = dr.Item("时间字段")
      

  2.   

    其实这个很简单,图片在数据库中你只需要存如图片的相对路径就行了,在读取数据的时候,直接把数据库存取的路径读取到img src中。上传的时间你可以用时间空件,用户选择的时间直接当作字符串存如数据库!
      

  3.   

    其实这个很简单,图片在数据库中你只需要存如图片的相对路径就行了,在读取数据的时候,直接把数据库存取的路径读取到img src中。上传的时间你可以用时间空件,用户选择的时间直接当作字符串存如数据库!