using System;
using System
using System
using System
using System
using System
using System
using System
using System
[WebServiceBinding(ConformsTo = WsiProfiles
public class Service : System
{
private OracleConnection webConnection;
DataTable curDt = new DataTable();
DataSet curSet = new DataSet();
OracleDataAdapter curDa = new OracleDataAdapter();
OracleCommand curComm = new OracleCommand();
private string GetCurCnnStr()
{
//連接數據庫並打開
OracleConnectionStringBuilder cnnStrBuilder = new OracleConnectionStringBuilder();
cnnStrBuilder
cnnStrBuilder
cnnStrBuilder
return cnnStrBuilder
}
public Service()
{
//如果使用設計的組件
//InitializeComponent();
}
[WebMethod(Description =
private OracleParameter CreateParam(string ParamName
{
OracleParameter Result = new OracleParameter();
Result
if (ParamValue != null)
{
Result
}
else
{
Result
}
return Result;
}
[WebMethod(Description =
public string Linking()
{
return
}
[WebMethod(Description =
public byte[] Search(string img)
{
try
{
webConnection = new OracleConnection(GetCurCnnStr());
webConnection
//查詢表中的所有的數據
OracleDataAdapter webAdapter = new OracleDataAdapter(
DataSet webDataTable = new DataSet();
//byte[] webDataTable = new byte[
webAdapter
webConnection
//序列化為二進制
webDataTable
BinaryFormatter bFormatter = new BinaryFormatter();
MemoryStream mStream = new MemoryStream();
bFormatter
byte[] bytes = mStream
//返回數組
return bytes;
}
catch (Exception)
{
curComm
return null;
}
finally
{
webConnection
}
}
[WebMethod(Description =
public void Add(string id
{
try
{
webConnection = new OracleConnection(GetCurCnnStr());
curComm
webConnection
curComm
curComm
curComm
curComm
curComm
curComm
}
catch (Exception)
{
curComm
}
finally
{
webConnection
}
}
}
unit Unit
interface
uses
Windows
Dialogs
Service
//StrUtils:取指定字符
{QDialogs:在delphi
為了支持kylix
每一個單元都增加了對應的QDialogs單元
如果你用了帶Q的單元
要想在Windows中正常運行必須得有qtintf
的支持你可以搜索一個
單元前有Q的把Q去掉就ok了! }
type
TForm
Label
Edit
Panel
Image
HTTPRIO
Open: TOpenDialog;
Search: TButton;
Add: TButton;
Update: TButton;
Delete: TButton;
Panel
Image
Label
procedure SearchClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Image
procedure Edit
procedure Image
procedure AddClick(Sender: TObject);
procedure DeleteClick(Sender: TObject);
procedure UpdateClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form
files:TFileStream;
ms:TMemoryStream;
jpg:TjpegImage;
s:TByteDynArray;
path:WideString;
implementation
{$R *
procedure TForm
var
bmTemp:TjpegImage;//TBitmap;
Web_Search:ServiceSoap;
begin
bmTemp:=TjpegImage
//創建流
ms:=TMemoryStream
Web_Search:=HTTPRIO
try
if (edit
begin
//調用服務查詢功能
s:=(Web_Search
if(length(s)<
begin
showmessage(
image
end
else
begin
//從圖片開始位置讀取
ms
ms
//加載流
bmTemp
//輸出
image
end;
end
else
begin
showmessage(
image
edit
end;
finally
//釋放空間
ms
bmTemp
//控制
//edit
edit
end;
end;
procedure TForm
var
fstyle: dWord;
begin
//控制edit只輸入數字
fstyle := GetWindowLong(Edit
SetWindowLong(Edit
//指定圖片格式
edit
end;
procedure TForm
var
Web_link:ServiceSoap;
begin
//測試連接
Web_link:=HTTPRIO
showmessage(
end;
procedure TForm
begin
//輸入控制
if key=#
Search
end;
procedure TForm
var
testpath:string;
testname:string;
begin
ms:=TMemoryStream
jpg:=TjpegImage
if Open
begin
testpath:=ExtractFileName(open
testname:=RightStr(testpath
if (testname=
begin
path:=ExtractFileDir(open
files:= TFileStream
try
jpg
jpg
image
finally
files
end;
end
else
showmessage(
end;
end;
end
From:http://tw.wingwit.com/Article/program/ASP/201311/21728.html