Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
getdata.cs
Package: Visual.rar [view]
Upload User: yiyuerguo
Upload Date: 2014-09-27
Package Size: 3781k
Code Size: 1k
Category:
CSharp
Development Platform:
Others
- using System;
- using System.Data;
- using System.Data.SqlClient;
- using System.Drawing;
- using System.IO;
- namespace photo
- {
- public class image_query
- {
- string image_filename = null;
- byte[] image_bytes = null;
- SqlConnection image_connection = null;
- SqlCommand image_command = null;
- SqlDataReader image_reader = null;
- public image_query()
- {
- image_connection = new SqlConnection(
- @"Data Source=(local);" +
- "Integrated Security=SSPI;" +
- "Initial Catalog=EAlbum;" +
- "Connect Timeout=3");
- image_command = new SqlCommand(
- @"SELECT name, photo FROM Photos",
- image_connection);
- // Open the connection and read data into the DataReader.
- image_connection.Open();
- image_reader = image_command.ExecuteReader();
- }
- public Bitmap get_image()
- {
- MemoryStream ms = new MemoryStream(image_bytes);
- Bitmap bmap = new Bitmap(ms);
- return bmap;
- }
- public string get_filename()
- {
- return image_filename;
- }
- public bool get_row()
- {
- //如果还可以读取 则读取该行
- if (image_reader.Read())
- {
- image_filename = (string) image_reader.GetValue(0);
- image_bytes = (byte[]) image_reader.GetValue(1);
- return true;
- }
- else
- {
- return false;
- }
- }
- public void end_query()
- {
- // Close the reader and the connection.
- image_reader.Close();
- image_connection.Close();
- }
- }
- }