| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 581 人关注过本帖
标题:请教大家,下面这些程序都是用的都是什么语言?共三段
只看楼主 加入收藏
polaris101
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-6-3
收藏
 问题点数:0 回复次数:1 
请教大家,下面这些程序都是用的都是什么语言?共三段
第一篇    com.txt ×××××××××××××××××× unit BuildExcel_Unit; {$WARN SYMBOL_PLATFORM OFF} interface uses Windows, ActiveX, Classes, ComObj, BuildExcel_TLB, StdVcl,IniFiles,AdoDB,DB, Variants,Sysutils; type TUpdateExcel = class(TTypedComObject, IUpdateExcel) private function WriteExcel(TableName, xlsName: String): String; protected function UpdateExcel(const TableName, ExcelName: WideString; out v_Err: WideString): HResult; stdcall; {Declare IUpdateExcel methods here} end; implementation uses ComServ; function TUpdateExcel.UpdateExcel(const TableName, ExcelName: WideString; out v_Err: WideString): HResult; begin v_Err:=WriteExcel(TableName,ExcelName); Result:=0; end; function TUpdateExcel.WriteExcel(TableName, xlsName: String): String; Var Excel:OleVariant; RowNo:Integer; ColNo:Integer; FileName:String; Buf:Array[0..Max_Path] Of Char; Ret:Integer; Ini:TIniFile; Query:TAdoQuery; IDeasPath:String; begin Query:=TAdoQuery.Create(nil); Ret:=GetSystemDirectory(Buf,MAX_PATH); FileName:=Copy(Buf,1,Ret)+'\cscw.ini'; Ini:=TIniFile.Create(FileName); Query.ConnectionString:=Ini.ReadString('Agent','DBConnect',''); IDeasPath:=Ini.ReadString('Agent','IdeasPath','c:\'); Ini.Free; Query.Close; Query.SQL.Text:='Select * From '+TableName; Try Query.Active:=True; Except On E:Exception Do Begin Result:=E.Message; Exit; End; End; Try Excel:=CreateOleObject('Excel.Application'); Except On E:Exception Do Begin Result:='创建Excel对象错误:'+E.Message; Exit; End; End; Try Result:='写入Excel失败'; If (Length(IDeasPath)>0) Then Begin If Copy(IDeasPath,Length(IDeasPath),1)<>'\' Then IDeasPath:=IDeasPath+'\'; End; Excel.WorkBooks.Open(IDeasPath+xlsName); Excel.ActiveWorkBook.Sheets[1].Select; RowNo:=3; While Not Query.Eof Do Begin For ColNo:=2 To Query.FieldCount-1 Do Excel.ActiveSheet.Cells[RowNo,ColNo+1]:=Query.Fields[ColNo].AsString; Query.Next; Inc(RowNo); End; Excel.ActiveWorkBook.Save; Excel.Visible:=True; Result:=''; Finally Excel.Quit; Excel:=Null; Query.Close; Query.Free; Result:=''; End; end; initialization TTypedComObjectFactory.Create(ComServer, TUpdateExcel, Class_UpdateExcel, ciMultiInstance, tmApartment); end. ×××××××××××××××××××××××× 第二段ISAPI.txt unit DM_Unit; interface uses SysUtils, Classes, HTTPApp,WinSock,Windows, ADODB, DB,BuildExcel_TLB,IniFiles; type TSStatus=(SSBUSY,SSFREE,SSLOCK); TWebMD = class(TWebModule) PubConn: TADOConnection; Query: TADOQuery; AdoCmd: TADOCommand; procedure WebMDFormCommitAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); procedure WebModuleCreate(Sender: TObject); procedure WebModuleException(Sender: TObject; E: Exception; var Handled: Boolean); private { Private declarations } v_UserName:String; v_Remark:String; function StartSocket(Addr:String;Port:Word): Boolean; Function SCloseSocket():Boolean; Function CheckStatus:TSStatus; Function UpdatePDM(TableName:String;Var Err:String):Boolean; Function UpdateDB(Request: TWebRequest;Var TableName:String):Boolean; Procedure MakeResponse(Response:TWebResponse;v_ErrData:String); public { Public declarations } end; var WebMD: TWebMD; sClient:TSocket; ServerIP:String; ServerPort:Word; TimeOut:Integer; IDeasPath:String; VrmlPath:String; implementation {$R *.dfm} { TWebMD } Function SendData(Addr:String;Port:Word;Data:String):String; //socket 数据发送 Var Ret,Times:Integer; Buf:Array[0..511] Of Char; Begin Try Ret:=Send(SClient,PChar(Data)^,Length(Data),0); If Ret<>Length(Data) Then Begin Result:=''; CloseSocket(SClient); WSACleanup; Exit; End; Ret:=0; Times:=0; While Ret=0 Do Begin Ret:=Recv(SClient,Buf,SizeOf(Buf),0); Sleep(10); Inc(Times); If Times=TimeOut Then Break; End; If Times=TimeOut Then Result:='' Else Result:=Copy(Buf,1,Ret); Except On E:Exception Do Result:=E.Message; End; End; function TWebMD.CheckStatus: TSStatus; Var Ret:String; begin Result:=SSBUSY; Ret:=SendData(ServerIP,ServerPort,'C'+#13); If SameText(Copy(Ret,1,1),'F') Then Result:=SSFREE; If SameText(Copy(Ret,1,1),'B') Then Result:=SSLOCK; end; procedure TWebMD.MakeResponse(Response: TWebResponse; v_ErrData: String); begin Response.Content:=v_ErrData; end; function TWebMD.SCloseSocket: Boolean; begin Try CloseSocket(SClient); WSACleanup; Result:=True; Except Result:=False; End; end; function TWebMD.StartSocket(Addr: String; Port: Word): Boolean; Var WSAData: TWSAData; Server:SockAddr_In; Begin If WSAStartup(MakeWord(2,2),WSAData)<>0 Then Begin Result:=False; Exit; End; SClient:=Socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); If SClient=INVALID_SOCKET Then Begin Result:=False; WSACleanup; Exit; End; Server.sin_family:=AF_INET; Server.sin_port:=htons(Port); Server.sin_addr.S_addr:=INet_Addr(PChar(Addr)); If Connect(SClient,Server,SizeOf(Server))=Socket_Error Then Begin Result:=False; WSACleanup; End else Result:=True; end; function TWebMD.UpdateDB(Request: TWebRequest; var TableName: String): Boolean; Var v_Sql,v_TableName,v_Field:String; begin Result:=False; If (Request.ContentFields.IndexOfName('TableName')=-1) And (Request.ContentFields.IndexOfName('UserName')=-1) then Exit; If Request.ContentFields.IndexOfName('Remark')=-1 Then v_Remark:='' Else v_Remark:=Request.ContentFields.Values['Remark']; v_UserName:=Request.ContentFields.Values['UserName']; TableName:=Request.ContentFields.Values['TableName']; v_TableName:=TableName; v_Sql:='Select * From '+v_TableName; Query.Close; Query.SQL.Text:=v_Sql; Query.Active:=True; Try While Not Query.Eof Do Begin v_Field:=Query.FieldByName('Name').AsString; If Request.ContentFields.IndexOfName(v_Field)<>-1 then Begin v_Sql:='Update '+v_TableName+' Set Results='+ Request.ContentFields.Values[v_Field]+ ' Where Name='''+v_Field+''''; AdoCmd.CommandText:=v_Sql; AdoCmd.Execute; End; Query.Next; End; Result:=True; Except Result:=False; End; Query.Close; end; function TWebMD.UpdatePDM(TableName:String;Var Err:String): Boolean; Var VrmlFile,ExcelFile:String; begin Result:=False; VrmlFile:=VrmlPath+TableName+'.wrl'; If Not FileExists(VrmlFile) Then Begin Err:='Vrml文件不存在!'; Exit; End; ExcelFile:=VrmlPath+TableName+'.xls'; If Not FileExists(ExcelFile) Then Begin Err:='Excel文件不存在!'; Exit; End; Try Query.Close; Query.SQL.Text:='Select * From PDM Where 1<>1'; Query.Active:=True; Query.Append; Query.FieldByName('UserName').AsString:=v_UserName; Query.FieldByName('PartName').AsString:=TableName; Query.FieldByName('Remark').AsString:=v_Remark; TBlobField(Query.FieldByName('Vrml')).LoadFromFile(VrmlFile); TBlobField(Query.FieldByName('Excel')).LoadFromFile(ExcelFile); Query.Post; Result:=True; Except On E:Exception Do Err:=E.Message; End; end; procedure TWebMD.WebMDFormCommitAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var v_Error:String; v_Content,v_TableName:String; v_Obj:IUpdateExcel; v_Err:WideString; begin v_Content:=''; v_Error:=''; Try if Not StartSocket(ServerIP,ServerPort) Then Begin v_Error:='建立Socket失败。
'; MakeResponse(Response,v_Error); Handled:=True; Exit; End; //检查服务器工作状态 Case CheckStatus Of SSBUSY: Begin v_Error:='服务器正在处理其他业务,请稍候提交。
'; MakeResponse(Response,v_Error); Handled:=True; SCloseSocket; Exit; End; SSLOCK: Begin v_Error:='服务器处于业务锁定状态,请稍候提交。
'; MakeResponse(Response,v_Error); Handled:=True; SCloseSocket; Exit; End; End; //更新数据库 If Not UpdateDB(Request,v_TableName) Then Begin v_Error:='更新数据库失败,请重新操作。
'; MakeResponse(Response,v_Error); SCloseSocket; Handled:=True; Exit; End; //生成Excel v_Obj:=coUpdateExcel.Create; v_Obj.UpdateExcel(v_TableName,v_TableName+'.xls',v_Err); If v_Err<>'' Then Begin MakeResponse(Response,v_Err); Handled:=True; SCloseSocket; v_Obj:=nil; Exit; End; v_Obj:=nil; //执行I-Deas v_Error:=SendData(ServerIP,ServerPort,v_TableName+#13); If v_Error='' Then Begin MakeResponse(Response,v_Error); Handled:=True; SCloseSocket; Exit; End; SCloseSocket; If Not UpdatePDM(v_TableName,v_Error) Then Begin MakeResponse(Response,v_Error); Handled:=True; SCloseSocket; Exit; End; MakeResponse(Response,'Finished'); Handled:=True; Except On E:Exception Do Begin Response.Content:='系统处理错误:'+E.Message; SCloseSocket; Handled:=True; End; End; end; procedure TWebMD.WebModuleCreate(Sender: TObject); Var FileName:String; Buf:Array[0..Max_Path] Of Char; Ret:Integer; Ini:TIniFile; begin Ret:=GetSystemDirectory(Buf,MAX_PATH); FileName:=Copy(Buf,1,Ret)+'\cscw.ini'; Ini:=TIniFile.Create(FileName); ServerIP:=Ini.ReadString('Agent','ServerIP','127.0.0.1'); ServerPort:=Ini.ReadInteger('Agent','ServerPort',10000); PubConn.ConnectionString:=Ini.ReadString('Agent','DBConnect',''); IDeasPath:=Ini.ReadString('Agent','IdeasPath','c:\'); VrmlPath:=Ini.ReadString('Agent','VrmlPath','c:\'); Ini.Free; end; procedure TWebMD.WebModuleException(Sender: TObject; E: Exception; var Handled: Boolean); begin Response.Content:=E.Message; Handled:=True; end; end. 第三段    脚本.sql if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Front]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[Front] GO if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[PDM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[PDM] GO CREATE TABLE [dbo].[Front] ( [Name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NOT NULL , [Expression] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [Results] [decimal](18, 0) NULL , [Units] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [Status] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[PDM] ( [ID] [int] IDENTITY (1, 1) NOT NULL , [username] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [partname] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL , [vrml] [image] NULL , [excel] [image] NULL , [remark] [ntext] COLLATE Chinese_PRC_CI_AS NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[PDM] ADD CONSTRAINT [PK_PDM] PRIMARY KEY CLUSTERED ( [ID] ) ON [PRIMARY] GO 请教这些分别是用什么语言编的 它们是什么意思呢?? 小弟好去图书馆借相关的书籍资料来看懂这些语言 谢谢了
搜索更多相关主题的帖子: 语言 
2007-06-07 22:26
ouzhiguang
Rank: 1
来 自:湖南长沙
等 级:新手上路
威 望:1
帖 子:240
专家分:0
注 册:2007-5-18
收藏
得分:0 
是Delphi语言编的
2007-06-08 08:44
快速回复:请教大家,下面这些程序都是用的都是什么语言?共三段
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019080 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved