• 从数据库读取图片,并固定显示


    <asp:datagrid id="DG_Persons" Width="168px" HeaderStyle-HorizontalAlign="Center" Runat="server"
                                BorderColor
    ="Black" ItemStyle-BackColor="Beige" HeaderStyle-ForeColor="#ffffff" HeaderStyle-Font-Bold="True"
                                HeaderStyle
    -BackColor="#ff0000" AutoGenerateColumns="False">
                                
    <ItemStyle BackColor="Beige"></ItemStyle>
                                
    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="White" BackColor="Red"></HeaderStyle>
                                
    <Columns>
                                    
    <asp:TemplateColumn HeaderText="图片">
                                        
    <ItemTemplate>
                                            
    <asp:Image id=Image3 Height="186px" ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "imgid")) %>' Width="212px" Runat="server">
                                            </asp:Image>
                                        
    </ItemTemplate>
                                    
    </asp:TemplateColumn>
                                
    </Columns>
                            
    </asp:datagrid>
     Private Sub BindGrid(ByVal id)

            
    Dim strCnn As String = "server=.;database=master1;uid=sa;pwd="

            
    Dim myConnection As SqlConnection = New SqlConnection(strCnn)
            
    Dim dst As New DataSet
            
    Dim sda As SqlDataAdapter
            
    'Dim myCommand As SqlCommand = New SqlCommand("SELECT * FROM image1 where imageid=" & i, myConnection)
            sda = New SqlDataAdapter("SELECT * FROM KS_img where imgID=" & id, myConnection)
            
    'myCommand.CommandType = CommandType.Text
            dst.Clear()
            sda.Fill(dst, 
    "aaa")

            
    Try

                myConnection.Open()
                row 
    = table.NewRow
                
    'row.Item("照片") = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
                row.Item("imgid"= dst.Tables("aaa").Rows(0).Item(0)
                row.Item(
    "Img"= dst.Tables("aaa").Rows(0).Item(1)
                
    'row.Item("PersonImage") = dst.Tables("aaa").Rows(0).Item(2)
                'row.Item("PersonImageType") = dst.Tables("aaa").Rows(0).Item(3)
                table.Rows.Add(row)
                table.GetChanges()

                myConnection.Close()
                
    Me.DG_Persons.DataSource = table
                
    Me.DG_Persons.DataBind()

            
    Catch SQLexc As SqlException

                Response.Write(
    "Error occured while Generating Data. Error is " & SQLexc.ToString())

            
    End Try

        
    End Sub

  • 相关阅读:
    OpenCV几种边缘检测的简例
    OpenCV人脸检测并把图片写成avi视频
    cvFindContours函数
    cvSmooth函数 和 OpenCV自带的人脸检测
    用OpenCV进行视频截取
    论文笔记 Network In Network
    论文笔记 Unsupervised Learning by Predicting Noise
    论文笔记 Spatial contrasting for deep unsupervised learning
    源码分析 Large-Margin Softmax Loss for Convolutional Neural Networks
    Caffe代码分析--crop_layer.cu
  • 原文地址:https://www.cnblogs.com/fxf568/p/532944.html
Copyright © 2020-2023  润新知