易截截图软件、单文件、免安装、纯绿色、仅160KB

Delphi Excel to Sql Server

 unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
  ExcelXP;
type
  TForm1 = class(TForm)
    ADOConn: TADOConnection;
    atblXlsToSql: TADOTable;
    DBGrid1: TDBGrid;
    Panel1: TPanel;
    Button1: TButton;
    opdExcel: TOpenDialog;
    DataSource1: TDataSource;
    Excel: TExcelApplication;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    function ConnectDB:boolean;              //连接数据库
    function  OpenTable(const Tablename:String):boolean;   //打开指定数据表
    function  XlsToSqlTable(const xlsFileName,TableName:String):boolean;  //将Excel数据导入Sql Server
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
  serverIP,dbName,userid,passw:string;  //服务器IP,数据库名称,用户名,密码
implementation
{$R *.dfm}
function TForm1.ConnectDB:boolean;
begin
  Result:=false;
  serverIP:='192.168.0.0';
  dbName:='OnLine';
  userid:='sa';
  passw:='sa';
  if not adoconn.Connected then
  begin
    adoconn.ConnectionString:='Provider=SQLOLEDB.1;Password=' + passw
                            + ';Persist Security Info=True;User ID=' + userid
                            + ';Initial Ca


相关文档:

delphi发送焦点移动消息的函数及参数


procedure TForm_BaseMDI.FormKeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
     begin
     Key := #0;
     SendMessage(Handle, 48384, 9, 0);     
     end;
end; ......

Delphi编译指令说明

《Delphi下深入Windows核心编程》(附录A Delphi编译指令说明)
摘抄人:麻子 qq:71892967
Delphi快速高小的编译器主要来自Object PASCAL的严谨,使用Delphi随时都在与编译器交流,大部分情况下不需要干涉编译器的运行,但是有时也需要对编译器进行必要的设置。
*************************************************** ......

sql server查询数据库中包含指定字符串的数据表

 发布一个实用小工具,可以很方便的在数据库中找到包含指定字符串的数据表名及相应记录:
/*
功能:查询数据库中包含指定字符串的数据表名及相应记录
作者:陈加鹏 chjpeng#163.com
日期:2009-08-17
*/
declare @key varchar(30)
set @key = 'test'    --替换为要查找的字符串
DECLARE @ ......

SQL 先筛选在关联的例子

select ID,Item1,Item2,Item3,Item4
into #Temp
from (
select ID='200910',Item1='A',Item2='B',Item3='C',Item4='T1'
union all
select ID='200910',Item1='',Item2='B',Item3='C' ,Item4='G2'
union all
select ID='200910',Item1='A',Item2='D',Item3='C' ,Item4='T3'
union all
select ID='200910',Item ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号