zoukankan
html css js c++ java
从数据库读取图片,并固定显示
<
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()
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
查看全文
相关阅读:
20170705总结
20170703总结
.NET 框架程序使用 Win32 API
青春 就此别过
Aptana Studio 2启动时提示 Workspace Cannot Be Created 解决办法
App_GlobalResources.afvubzdv.resources.dll”--“拒绝访问。“
c# 一维数组和二维数组的定义几种方式<转>.
C#中Split分隔字符串的应用(C#、split、分隔、字符串)<转>
C#操作字符串方法总结<转>
C# 时间格式大全
原文地址:https://www.cnblogs.com/fxf568/p/532944.html
最新文章
zoj 1677 Oil Deal 最大生成树 Andrew Stankevich's Contest #8(H)
hdu 1230 火星A+B
POJ1170 Shopping Offers <五维DP>
BZOJ1179【APOI2009】ATM <Tarjan>
POJ1182 【NOI2001】 食物链 <种类并查集>
BZOJ3110 K大数查询 <树套树>
POJ2155 Matrix <树套树/二维树状数组>
HDU5340 Three Palindromes <Manacher>
BZOJ2588 Count on a tree <DFS序+LCA+值域主席树>
BZOJ1798 【AHOI2009】 seq维护序列 <线段树>
热门文章
POJ1201 Intervals <差分约束系统>
BZOJ2002 Bounce 弹飞绵羊 <分块>
BZOJ2434【NOI2011】阿狸的打字机 <AC自动机+Fail树+树状数组>
BZOJ3673 可持久化并查集 by zky <可持久化数组+主席树>
可持久化线段树/主席树 基础原理和例题
AC自动机模板及基础例题小结
20170710总结
20170707总结
20170706总结
20170704总结
Copyright © 2011-2022 走看看