Home > Net >  The Gridview displays the binary images in the database
The Gridview displays the binary images in the database

Time:10-30

Ask a operations
Want to display in the GridView binary images stored in the database, how to write code? (the Image in the database column names called: Attachment)
Reads in.aspx
 
<% @ Page Language="VB" AutoEventWireup="false" CodeFile="homework. Aspx. VB Inherits"="homework" % & gt;
.


In the first place: how to write?






In the aspx. Vb code:
 
.
The main page displays
Sub UpdateGridView ()
.
If IsDBNull (drpIndustry SelectedValue) Or drpIndustry.SelectedValuehttps://bbs.csdn.net/topics/="" Then
The Else
MySQL1=mySQL1 & amp; "AND Industry=N '" & amp; DrpIndustry. SelectedValue & amp; "'
"End the If
MySQL1="SELECT * from tablename a" & amp; _
"Where a.S howFlag=1" & amp; _
"" & amp; MySQL1 & amp; "
"Me. SqlDataSource1. SelectCommand=mySQL1
The second: how to write?
Con. The Close ()
End Sub

CodePudding user response:

Is there a big answer ah ~ ~

CodePudding user response:

Puts a picturebox Gridview, how do the pictures according to the binary code into the database, you need to also read it out according to the original method, convert images into a picturebox
//image into binary stream

 
Ms=new MemoryStream ();
MImage. Save (ms, ImageFormat. Bmp);
Long msLength=Ms. Length;
S.S end (BitConverter GetBytes (msLength));
Ms. Position=0;

While (true)
{
Byte [] bits=new byte [1024].
//int p=(int) Ms. Position;
Int r=Ms. Read (bits, 0, bits. Length);

If (r & lt;=0)
{
break;//if is read from the stream, the break;
}
S.S end (bits, r, SocketFlags. None).
}
Ms. Position=0;

CodePudding user response:

WebForm
Too old things, forget about, I look

https://www.cnblogs.com/travelcai/archive/2007/09/27/907203.html
https://www.cnblogs.com/freeliver54/archive/2007/05/23/756652.html

Ps: you can see, article 2007, it is too old, suggest if only is mixed in the school curriculum, webform basic nothing with this thing, do not recommend spend too much time, might as well a week LintCode brush to brush the topic, you need to be able to brush LintCode of a 7788, basically can then also OK (although LintCode is sometimes, the way of doing things but OK)

CodePudding user response:

Ps: if you did not use adpro shielding this station advertising, in you the problems related to the bottom of the page, you can see,

CSDN, he specializes in the search box to search out what things, is the right and some of the following "intelligent classification recommended" comparative high correlation can occasionally occur
  • Related