System.Drawing.Image image=new System.Drawing.Bitmap(流,true);就可以阿.
解决方案 »
- 求一个c#正则表达式的写法
- [IE编程]能否同时RegisterNameSpace RegisterMime ?
- 求高手帮忙用C#的TreeWiew写一个树型实例
- 我将常用的用户信息保存在cache中:HttpRuntime.Cache.Insert(key, item);但怎样可修改它而不影响其它用户对它的访问?
- 如何获取Excel单元格 下一列格子的标志,比如“E1”下一列”E2“
- cmd.CommandText = "select * from CourseSelect where fStudentID= '" + label1.Text
- 百度地图 怎么实现这样功能,画一个区域图,然后判断车子是否进入访区域
- C#做的winform程序,内含水晶报表,打包问题
- 怎样在formB中操作formA上由Dataset定义表关系(DataRelation)所产生的子表?(winform)
- 我想利用程序对鼠标进行操纵,怎么办呢?
- 帮忙看一下~
- 问个关于winfrom中datagridview 删除列的问题 ..
byte[] bts = this.getdbBytes();
MemoryStream ms = new MemoryStream(bts);
Image img = Image.FromStream(ms);
Look
SqlCommand command = new SqlCommand(
"SELECT pub_id, logo FROM pub_info", connection);// Writes the BLOB to a file (*.bmp).
FileStream stream;
// Streams the BLOB to the FileStream object.
BinaryWriter writer; // Size of the BLOB buffer.
int bufferSize = 100;
// The BLOB byte[] buffer to be filled by GetBytes.
byte[] outByte = new byte[bufferSize];
// The bytes returned from GetBytes.
long retval;
// The starting position in the BLOB output.
long startIndex = 0; // The publisher id to use in the file name.
string pubID = ""; // Open the connection and read data into the DataReader.
connection.Open();
SqlDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess);while (reader.Read())
{
// Get the publisher id, which must occur before getting the logo.
pubID = reader.GetString(0); // Create a file to hold the output.
stream = new FileStream(
"logo" + pubID + ".bmp", FileMode.OpenOrCreate, FileAccess.Write);
writer = new BinaryWriter(stream); // Reset the starting byte for the new BLOB.
startIndex = 0; // Read bytes into outByte[] and retain the number of bytes returned.
retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize); // Continue while there are bytes beyond the size of the buffer.
while (retval == bufferSize)
{
writer.Write(outByte);
writer.Flush(); // Reposition start index to end of last buffer and fill buffer.
startIndex += bufferSize;
retval = reader.GetBytes(1, startIndex, outByte, 0, bufferSize);
} // Write the remaining buffer.
writer.Write(outByte, 0, (int)retval - 1);
writer.Flush(); // Close the output file.
writer.Close();
stream.Close();
}// Close the reader and the connection.
reader.Close();
connection.Close();