请问如何将SQL SERVER数据库中的图片导入DATAGRID并正常显示为图片,如何在企业管理器中知道图片字段(二进制)是否为空,因为空与不空im

csharplove 2003-04-11 08:18:39
请问如何将SQL SERVER数据库中的图片导入DATAGRID并正常显示为图片,如何在企业管理器中知道图片字段(二进制)是否为空,因为空与不空image字段值都是binary,我不太懂SQL等数据库东东
敬请指教
...全文
60 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
极限999 2003-10-02
  • 打赏
  • 举报
回复
mark
yirenboy 2003-09-09
  • 打赏
  • 举报
回复
哈哈,这个简单
在查询分析器里 SELECT * FROM YourTable WHERE 图字段 IS NOT NULL

楼上的不用这么兴师动众哈
gqxm 2003-09-09
  • 打赏
  • 举报
回复
http://www.chinaaspx.com/searchsite.htm
孟子E章 2003-09-05
  • 打赏
  • 举报
回复
http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=EY1XLDYV-PIDF-43LO-1WFL-FMY5ALE1F635
PoorAngel 2003-09-05
  • 打赏
  • 举报
回复
收藏!
yypt111 2003-04-15
  • 打赏
  • 举报
回复
将数据库字段定义为image(可以存放:Doc,Txt,Gif,Jpg...所有文件)
yypt111 2003-04-15
  • 打赏
  • 举报
回复
假设你的Image参数:VbyteFile[](以二进制数组传入)

这样判断:
if (VbyteFile==null){
//
}
else
{
//
}
DavidBone 2003-04-15
  • 打赏
  • 举报
回复
up
lhfeng 2003-04-11
  • 打赏
  • 举报
回复
读取:
<asp:TemplateColumn HeaderText="Image">
<ItemTemplate>
<asp:Image
Width="150" Height="125"
ImageUrl='<%# FormatURL(DataBinder.Eval(Container.DataItem, "PersonID")) %>'
Runat=server />
</ItemTemplate>
</asp:TemplateColumn>


And the method FormatURL (A Server side Function) is as follows.

Function FormatURL(strArgument) as String
Return ("readrealimage.aspx?id=" & strArgument)
End Function

And the method FormatURL (A Server side Function) is as follows.

Function FormatURL(strArgument) as String
Return ("readrealimage.aspx?id=" & strArgument)
End Function
显示:
Public Sub Page_Load(sender As Object, e As EventArgs)

Dim strImageID as String = Request.QueryString("id")

' Create Instance of Connection and Command Object
Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlCommand("Select PersonImageType, PersonImage from das_person_real_images Where PersonID=" & strImageID, myConnection)

' I have used the select statement. But it would be much much better, if you
'could write a small stored procedure which contains the above sql statement.
' Mark the Command as a SPROC (in case, if you wrote the stored procedure
'myCommand.CommandType = CommandType.StoredProcedure

Try
myConnection.Open()
Dim myDataReader as SqlDataReader
myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While (myDataReader.Read())
Response.ContentType = myDataReader.Item("PersonImageType")
Response.BinaryWrite(myDataReader.Item("PersonImage"))
Loop
myConnection.Close()
Catch SQLexc As SqlException

End Try

End Sub

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧