chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-LN"c:\program files\borland\delphi7\Projects\Bpl"
|
||||
-w-UNSAFE_TYPE
|
||||
-w-UNSAFE_CODE
|
||||
-w-UNSAFE_CAST
|
||||
@@ -0,0 +1,136 @@
|
||||
[FileVersion]
|
||||
Version=7.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
NamespacePrefix=
|
||||
SymbolDeprecated=1
|
||||
SymbolLibrary=1
|
||||
SymbolPlatform=1
|
||||
UnitLibrary=1
|
||||
UnitPlatform=1
|
||||
UnitDeprecated=1
|
||||
HResultCompat=1
|
||||
HidingMember=1
|
||||
HiddenVirtual=1
|
||||
Garbage=1
|
||||
BoundsError=1
|
||||
ZeroNilCompat=1
|
||||
StringConstTruncated=1
|
||||
ForLoopVarVarPar=1
|
||||
TypedConstVarPar=1
|
||||
AsgToTypedConst=1
|
||||
CaseLabelRange=1
|
||||
ForVariable=1
|
||||
ConstructingAbstract=1
|
||||
ComparisonFalse=1
|
||||
ComparisonTrue=1
|
||||
ComparingSignedUnsigned=1
|
||||
CombiningSignedUnsigned=1
|
||||
UnsupportedConstruct=1
|
||||
FileOpen=1
|
||||
FileOpenUnitSrc=1
|
||||
BadGlobalSymbol=1
|
||||
DuplicateConstructorDestructor=1
|
||||
InvalidDirective=1
|
||||
PackageNoLink=1
|
||||
PackageThreadVar=1
|
||||
ImplicitImport=1
|
||||
HPPEMITIgnored=1
|
||||
NoRetVal=1
|
||||
UseBeforeDef=1
|
||||
ForLoopVarUndef=1
|
||||
UnitNameMismatch=1
|
||||
NoCFGFileFound=1
|
||||
MessageDirective=1
|
||||
ImplicitVariants=1
|
||||
UnicodeToLocale=1
|
||||
LocaleToUnicode=1
|
||||
ImagebaseMultiple=1
|
||||
SuspiciousTypecast=1
|
||||
PrivatePropAccessor=1
|
||||
UnsafeType=0
|
||||
UnsafeCode=0
|
||||
UnsafeCast=0
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=1028
|
||||
CodePage=950
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
@@ -0,0 +1,13 @@
|
||||
program Project1;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
Unit1 in 'Unit1.pas' {Form1};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
[Stats]
|
||||
EditorSecs=1797
|
||||
DesignerSecs=531
|
||||
InspectorSecs=860
|
||||
CompileSecs=46832
|
||||
OtherSecs=713
|
||||
StartTime=2007/11/27 10:11:30
|
||||
RealKeys=0
|
||||
EffectiveKeys=0
|
||||
DebugSecs=4128
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,454 @@
|
||||
object Form1: TForm1
|
||||
Left = 261
|
||||
Top = 220
|
||||
Width = 870
|
||||
Height = 640
|
||||
Caption = 'Form1'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'MiNGLIU'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Splitter2: TSplitter
|
||||
Left = 0
|
||||
Top = 306
|
||||
Width = 862
|
||||
Height = 5
|
||||
Cursor = crVSplit
|
||||
Align = alTop
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 0
|
||||
Top = 352
|
||||
Width = 862
|
||||
Height = 256
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 862
|
||||
Height = 306
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 1
|
||||
object Splitter1: TSplitter
|
||||
Left = 201
|
||||
Top = 0
|
||||
Width = 5
|
||||
Height = 306
|
||||
end
|
||||
object DBGrid2: WDBGRID
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 201
|
||||
Height = 306
|
||||
Align = alLeft
|
||||
DataSource = DataSource1
|
||||
TabOrder = 0
|
||||
TitleFont.Charset = DEFAULT_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = 'MiNGLIU'
|
||||
TitleFont.Style = []
|
||||
IsTwoColor = True
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
AllowAppend = True
|
||||
AllowDelete = True
|
||||
IsVerScrollBar = True
|
||||
MenuShow = [msWDGM, msExcel, msDBF, msDB, msTXT, msMDB]
|
||||
end
|
||||
object DBGrid1: WDBGRID
|
||||
Left = 206
|
||||
Top = 0
|
||||
Width = 656
|
||||
Height = 306
|
||||
Align = alClient
|
||||
DataSource = DataSource2
|
||||
TabOrder = 1
|
||||
TitleFont.Charset = DEFAULT_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = 'MiNGLIU'
|
||||
TitleFont.Style = []
|
||||
IsTwoColor = True
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
AllowAppend = True
|
||||
AllowDelete = True
|
||||
IsVerScrollBar = True
|
||||
MenuShow = [msWDGM, msExcel, msDBF, msDB, msTXT, msMDB]
|
||||
Columns = <
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #34920#26684#21517#31281
|
||||
Width = -1
|
||||
Visible = False
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #38917#27425
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #27396#20301#21517#31281
|
||||
Width = 60
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #22411#24907
|
||||
PickList.Strings = (
|
||||
'CHAR'
|
||||
'NCHAR'
|
||||
'TEXT'
|
||||
'NTEXT'
|
||||
'VARCHAR'
|
||||
'NVARCHAR'
|
||||
'INT'
|
||||
'DECIMAL'
|
||||
'DATETIME'
|
||||
'DOUBLE'
|
||||
'IMAGE')
|
||||
Width = 60
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #38263#24230
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #23567#25976
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = 'PK'
|
||||
Width = 16
|
||||
Visible = True
|
||||
Check = True
|
||||
ValueChecked = 'V'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = 'FK'
|
||||
Width = 16
|
||||
Visible = True
|
||||
Check = True
|
||||
ValueChecked = 'V'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #20013#25991#21517#31281
|
||||
Width = 120
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #39023#31034#20803#20214
|
||||
PickList.Strings = (
|
||||
'Label'
|
||||
'TextBox'
|
||||
'CheckBox'
|
||||
'ComboBox'
|
||||
'Memo'
|
||||
'Picture')
|
||||
Width = 80
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #32232#36655#20803#20214
|
||||
PickList.Strings = (
|
||||
'Label'
|
||||
'TextBox'
|
||||
'CheckBox'
|
||||
'ComboBox'
|
||||
'Memo'
|
||||
'Picture')
|
||||
Width = 80
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #20633#35387
|
||||
Width = 1500
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end>
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Top = 311
|
||||
Width = 862
|
||||
Height = 41
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 2
|
||||
object Button1: TButton
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 105
|
||||
Height = 25
|
||||
Caption = #29986#29983' Create SQL'
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 120
|
||||
Top = 8
|
||||
Width = 121
|
||||
Height = 25
|
||||
Caption = #29986#29983' ItemTemplate'
|
||||
TabOrder = 1
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 248
|
||||
Top = 8
|
||||
Width = 121
|
||||
Height = 25
|
||||
Caption = #29986#29983' InsertTemplate'
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object ADOConnection1: TADOConnection
|
||||
ConnectionString =
|
||||
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\VS.NET\Thinkyu\D' +
|
||||
'elphi\'#36039#26009#34920'.mdb;Persist Security Info=False'
|
||||
LoginPrompt = False
|
||||
Mode = cmShareDenyNone
|
||||
Provider = 'Microsoft.Jet.OLEDB.4.0'
|
||||
Left = 168
|
||||
Top = 408
|
||||
end
|
||||
object ADODataSet1: TADODataSet
|
||||
Connection = ADOConnection1
|
||||
CursorType = ctStatic
|
||||
AfterScroll = ADODataSet1AfterScroll
|
||||
CommandText = 'SELECT * FROM ['#36039#26009#34920'] ORDER BY ['#34920#26684#21517#31281']'
|
||||
Parameters = <>
|
||||
Left = 272
|
||||
Top = 408
|
||||
end
|
||||
object DataSource1: TDataSource
|
||||
DataSet = ADODataSet1
|
||||
Left = 368
|
||||
Top = 408
|
||||
end
|
||||
object ADODataSet2: TADODataSet
|
||||
Connection = ADOConnection1
|
||||
CursorType = ctStatic
|
||||
AfterInsert = ADODataSet2AfterInsert
|
||||
CommandText = 'SELECT * FROM ['#27396#20301'] WHERE ['#34920#26684#21517#31281']=:'#34920#26684#21517#31281#13#10'ORDER BY ['#38917#27425']'
|
||||
MasterFields = #34920#26684#21517#31281
|
||||
Parameters = <
|
||||
item
|
||||
Name = #34920#26684#21517#31281
|
||||
Attributes = [paNullable]
|
||||
DataType = ftWideString
|
||||
NumericScale = 255
|
||||
Precision = 255
|
||||
Size = 10
|
||||
Value = 'BCUS'
|
||||
end>
|
||||
Left = 272
|
||||
Top = 480
|
||||
object ADODataSet2DSDesigner: TWideStringField
|
||||
FieldName = #34920#26684#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner2: TSmallintField
|
||||
FieldName = #38917#27425
|
||||
end
|
||||
object ADODataSet2DSDesigner3: TWideStringField
|
||||
FieldName = #27396#20301#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner4: TWideStringField
|
||||
FieldName = #22411#24907
|
||||
Size = 10
|
||||
end
|
||||
object ADODataSet2DSDesigner5: TSmallintField
|
||||
FieldName = #38263#24230
|
||||
end
|
||||
object ADODataSet2DSDesigner6: TSmallintField
|
||||
FieldName = #23567#25976
|
||||
end
|
||||
object ADODataSet2PK: TWideStringField
|
||||
FieldName = 'PK'
|
||||
Size = 1
|
||||
end
|
||||
object ADODataSet2FK: TWideStringField
|
||||
FieldName = 'FK'
|
||||
Size = 1
|
||||
end
|
||||
object ADODataSet2DSDesigner7: TWideStringField
|
||||
FieldName = #20013#25991#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner8: TWideStringField
|
||||
FieldName = #39023#31034#20803#20214
|
||||
end
|
||||
object ADODataSet2DSDesigner9: TWideStringField
|
||||
FieldName = #32232#36655#20803#20214
|
||||
end
|
||||
object ADODataSet2DSDesigner10: TWideStringField
|
||||
FieldName = #20633#35387
|
||||
Size = 255
|
||||
end
|
||||
object ADODataSet2MaxItem: TAggregateField
|
||||
FieldName = 'MaxItem'
|
||||
Active = True
|
||||
Expression = 'MAX('#38917#27425')'
|
||||
end
|
||||
end
|
||||
object DataSource2: TDataSource
|
||||
DataSet = ADODataSet2
|
||||
Left = 368
|
||||
Top = 480
|
||||
end
|
||||
object DataSetProvider1: TDataSetProvider
|
||||
DataSet = ADODataSet2
|
||||
ResolveToDataSet = True
|
||||
Options = [poAutoRefresh]
|
||||
Left = 464
|
||||
Top = 480
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
AggregatesActive = True
|
||||
FetchOnDemand = False
|
||||
Params = <>
|
||||
ProviderName = 'DataSetProvider1'
|
||||
AfterInsert = ClientDataSet1AfterInsert
|
||||
AfterPost = ClientDataSet1AfterPost
|
||||
Left = 552
|
||||
Top = 480
|
||||
object ClientDataSet1CDSDesigner: TWideStringField
|
||||
FieldName = #34920#26684#21517#31281
|
||||
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner2: TSmallintField
|
||||
FieldName = #38917#27425
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner3: TWideStringField
|
||||
FieldName = #27396#20301#21517#31281
|
||||
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner4: TWideStringField
|
||||
FieldName = #22411#24907
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 10
|
||||
end
|
||||
object ClientDataSet1CDSDesigner5: TSmallintField
|
||||
FieldName = #38263#24230
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner6: TSmallintField
|
||||
FieldName = #23567#25976
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1PK: TWideStringField
|
||||
FieldName = 'PK'
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 1
|
||||
end
|
||||
object ClientDataSet1FK: TWideStringField
|
||||
FieldName = 'FK'
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 1
|
||||
end
|
||||
object ClientDataSet1CDSDesigner7: TWideStringField
|
||||
FieldName = #20013#25991#21517#31281
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner8: TWideStringField
|
||||
FieldName = #39023#31034#20803#20214
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner9: TWideStringField
|
||||
FieldName = #32232#36655#20803#20214
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner10: TWideStringField
|
||||
FieldName = #20633#35387
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 255
|
||||
end
|
||||
object ClientDataSet1MAXItem: TAggregateField
|
||||
FieldName = 'MAXItem'
|
||||
Active = True
|
||||
Expression = 'MAX('#38917#27425')'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,189 @@
|
||||
unit Unit1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB, ExtCtrls, wdbreg, DBClient,
|
||||
Provider;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
ADOConnection1: TADOConnection;
|
||||
ADODataSet1: TADODataSet;
|
||||
Memo1: TMemo;
|
||||
DataSource1: TDataSource;
|
||||
ADODataSet2: TADODataSet;
|
||||
DataSource2: TDataSource;
|
||||
Panel1: TPanel;
|
||||
DBGrid2: WDBGRID;
|
||||
DBGrid1: WDBGRID;
|
||||
Splitter1: TSplitter;
|
||||
Splitter2: TSplitter;
|
||||
DataSetProvider1: TDataSetProvider;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ClientDataSet1MAXItem: TAggregateField;
|
||||
Panel2: TPanel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
ADODataSet2MaxItem: TAggregateField;
|
||||
ClientDataSet1CDSDesigner: TWideStringField;
|
||||
ClientDataSet1CDSDesigner2: TSmallintField;
|
||||
ClientDataSet1CDSDesigner3: TWideStringField;
|
||||
ClientDataSet1CDSDesigner4: TWideStringField;
|
||||
ClientDataSet1CDSDesigner5: TSmallintField;
|
||||
ClientDataSet1CDSDesigner6: TSmallintField;
|
||||
ClientDataSet1PK: TWideStringField;
|
||||
ClientDataSet1FK: TWideStringField;
|
||||
ClientDataSet1CDSDesigner7: TWideStringField;
|
||||
ClientDataSet1CDSDesigner8: TWideStringField;
|
||||
ClientDataSet1CDSDesigner9: TWideStringField;
|
||||
ClientDataSet1CDSDesigner10: TWideStringField;
|
||||
ADODataSet2DSDesigner: TWideStringField;
|
||||
ADODataSet2DSDesigner2: TSmallintField;
|
||||
ADODataSet2DSDesigner3: TWideStringField;
|
||||
ADODataSet2DSDesigner4: TWideStringField;
|
||||
ADODataSet2DSDesigner5: TSmallintField;
|
||||
ADODataSet2DSDesigner6: TSmallintField;
|
||||
ADODataSet2PK: TWideStringField;
|
||||
ADODataSet2FK: TWideStringField;
|
||||
ADODataSet2DSDesigner7: TWideStringField;
|
||||
ADODataSet2DSDesigner8: TWideStringField;
|
||||
ADODataSet2DSDesigner9: TWideStringField;
|
||||
ADODataSet2DSDesigner10: TWideStringField;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure ListBox1Click(Sender: TObject);
|
||||
procedure ADODataSet1AfterScroll(DataSet: TDataSet);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure ClientDataSet1AfterInsert(DataSet: TDataSet);
|
||||
procedure ClientDataSet1AfterPost(DataSet: TDataSet);
|
||||
procedure ADODataSet2AfterInsert(DataSet: TDataSet);
|
||||
private
|
||||
procedure GenerateCreateSQL;
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
ADOConnection1.Connected := True;
|
||||
ADODataSet1.Open;
|
||||
ADODataSet2.Open;
|
||||
//ClientDataSet1.Open;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
ADODataSet2.Close;
|
||||
ADODataSet1.Close;
|
||||
ADOConnection1.Connected := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.ListBox1Click(Sender: TObject);
|
||||
begin
|
||||
//if ListBox1.ItemIndex = -1 then
|
||||
// Exit;
|
||||
|
||||
//ADODataSet1.Active := False;
|
||||
//ADODataSet1.CommandText := Format('SELECT * FROM [%S]', [ListBox1.Items[ListBox1.ItemIndex]]);
|
||||
//ADODataSet1.Active := True;
|
||||
|
||||
//GenerateCreateSQL;
|
||||
end;
|
||||
|
||||
procedure TForm1.GenerateCreateSQL;
|
||||
var recno: integer;
|
||||
s: string;
|
||||
fieldName, fieldType: string;
|
||||
aLength, aDecimal: integer;
|
||||
begin
|
||||
Memo1.Lines.Clear;
|
||||
Memo1.Lines.Append(Format('CREATE TABLE %s (', [ADODataSet2.FieldByName('表格名稱').AsString]));
|
||||
|
||||
ClientDataSet1.DisableControls;
|
||||
ClientDataSet1.First;
|
||||
recno := 1;
|
||||
while not ClientDataSet1.Eof do
|
||||
begin
|
||||
fieldName := ClientDataSet1.FieldByName('欄位名稱').AsString;
|
||||
fieldType := ClientDataSet1.FieldByName('型態').AsString;
|
||||
aLength := ClientDataSet1.FieldByName('長度').AsInteger;
|
||||
aDecimal := ClientDataSet1.FieldByName('小數').AsInteger;
|
||||
s := Format(' %s %s', [fieldName, fieldType]);
|
||||
|
||||
if fieldType = 'DECIMAL' then
|
||||
s := s + Format(' (%d, %d)', [aLength, aDecimal])
|
||||
else if Pos(fieldType, 'CHAR,NCHAR,VARCHAR,NVARCHAR') > 0 then
|
||||
s := s + Format(' (%d)', [aLength]);
|
||||
|
||||
if ClientDataSet1.FieldByName('PK').AsString = 'V' then
|
||||
s := s + ' NOT NULL ';
|
||||
|
||||
if recno < ClientDataSet1.RecordCount then
|
||||
s := s + ' ,'
|
||||
else
|
||||
s := s + ' )';
|
||||
Memo1.Lines.Append(s);
|
||||
Inc(recno);
|
||||
ClientDataSet1.MoveBy(1);
|
||||
end;
|
||||
Memo1.Lines.Append('GO');
|
||||
|
||||
ClientDataSet1.First;
|
||||
ClientDataSet1.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TForm1.ADODataSet1AfterScroll(DataSet: TDataSet);
|
||||
begin
|
||||
ClientDataSet1.Close;
|
||||
ADODataSet2.DisableControls;
|
||||
ADODataSet2.Close;
|
||||
ADODataSet2.Parameters.ParamValues['表格名稱'] := ADODataSet1.FieldValues['表格名稱'];
|
||||
ADODataSet2.Open;
|
||||
ClientDataSet1.Open;
|
||||
ADODataSet2.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
GenerateCreateSQL;
|
||||
end;
|
||||
|
||||
procedure TForm1.ClientDataSet1AfterInsert(DataSet: TDataSet);
|
||||
begin
|
||||
{
|
||||
if VarIsNull(ClientDataSet1.FieldByName('MAXItem').Value) then
|
||||
ClientDataSet1.FieldByName('項次').AsInteger := 1
|
||||
else
|
||||
ClientDataSet1.FieldByName('項次').AsInteger := ClientDataSet1.FieldByName('MAXItem').Value + 1;
|
||||
ClientDataSet1.FieldByName('表格名稱').AsString := ADODataSet1.FieldValues['表格名稱'];
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TForm1.ClientDataSet1AfterPost(DataSet: TDataSet);
|
||||
//var i: integer;
|
||||
begin
|
||||
//i := ClientDataSet1.ApplyUpdates(0);
|
||||
end;
|
||||
|
||||
procedure TForm1.ADODataSet2AfterInsert(DataSet: TDataSet);
|
||||
begin
|
||||
if VarIsNull(ClientDataSet1.FieldByName('MAXItem').Value) then
|
||||
ADODataSet2.FieldByName('項次').AsInteger := 1
|
||||
else
|
||||
ADODataSet2.FieldByName('項次').AsInteger := ClientDataSet1.FieldByName('MAXItem').Value + 1;
|
||||
ADODataSet2.FieldByName('表格名稱').AsString := ADODataSet1.FieldValues['表格名稱'];
|
||||
end;
|
||||
|
||||
end.
|
||||
Binary file not shown.
@@ -0,0 +1,453 @@
|
||||
object Form1: TForm1
|
||||
Left = 261
|
||||
Top = 220
|
||||
Width = 870
|
||||
Height = 640
|
||||
Caption = 'Form1'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = 'MiNGLIU'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Splitter2: TSplitter
|
||||
Left = 0
|
||||
Top = 306
|
||||
Width = 862
|
||||
Height = 5
|
||||
Cursor = crVSplit
|
||||
Align = alTop
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 0
|
||||
Top = 352
|
||||
Width = 862
|
||||
Height = 256
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 862
|
||||
Height = 306
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 1
|
||||
object Splitter1: TSplitter
|
||||
Left = 201
|
||||
Top = 0
|
||||
Width = 5
|
||||
Height = 306
|
||||
end
|
||||
object DBGrid2: WDBGRID
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 201
|
||||
Height = 306
|
||||
Align = alLeft
|
||||
DataSource = DataSource1
|
||||
TabOrder = 0
|
||||
TitleFont.Charset = DEFAULT_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = 'MiNGLIU'
|
||||
TitleFont.Style = []
|
||||
IsTwoColor = True
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
AllowAppend = True
|
||||
AllowDelete = True
|
||||
IsVerScrollBar = True
|
||||
MenuShow = [msWDGM, msExcel, msDBF, msDB, msTXT, msMDB]
|
||||
end
|
||||
object DBGrid1: WDBGRID
|
||||
Left = 206
|
||||
Top = 0
|
||||
Width = 656
|
||||
Height = 306
|
||||
Align = alClient
|
||||
DataSource = DataSource2
|
||||
TabOrder = 1
|
||||
TitleFont.Charset = DEFAULT_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = 'MiNGLIU'
|
||||
TitleFont.Style = []
|
||||
IsTwoColor = True
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
AllowAppend = True
|
||||
AllowDelete = True
|
||||
IsVerScrollBar = True
|
||||
MenuShow = [msWDGM, msExcel, msDBF, msDB, msTXT, msMDB]
|
||||
Columns = <
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #34920#26684#21517#31281
|
||||
Width = -1
|
||||
Visible = False
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #38917#27425
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #27396#20301#21517#31281
|
||||
Width = 60
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #22411#24907
|
||||
PickList.Strings = (
|
||||
'CHAR'
|
||||
'NCHAR'
|
||||
'TEXT'
|
||||
'NTEXT'
|
||||
'VARCHAR'
|
||||
'NVARCHAR'
|
||||
'INT'
|
||||
'DECIMAL'
|
||||
'DATETIME'
|
||||
'DOUBLE'
|
||||
'IMAGE')
|
||||
Width = 60
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #38263#24230
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #23567#25976
|
||||
Width = 28
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = 'PK'
|
||||
Width = 16
|
||||
Visible = True
|
||||
Check = True
|
||||
ValueChecked = 'V'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = 'FK'
|
||||
Width = 16
|
||||
Visible = True
|
||||
Check = True
|
||||
ValueChecked = 'V'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #20013#25991#21517#31281
|
||||
Width = 120
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #39023#31034#20803#20214
|
||||
PickList.Strings = (
|
||||
'Label'
|
||||
'TextBox'
|
||||
'CheckBox'
|
||||
'ComboBox'
|
||||
'Memo'
|
||||
'Picture')
|
||||
Width = 80
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #32232#36655#20803#20214
|
||||
PickList.Strings = (
|
||||
'Label'
|
||||
'TextBox'
|
||||
'CheckBox'
|
||||
'ComboBox'
|
||||
'Memo'
|
||||
'Picture')
|
||||
Width = 80
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end
|
||||
item
|
||||
Expanded = False
|
||||
FieldName = #20633#35387
|
||||
Width = 1500
|
||||
Visible = True
|
||||
ValueChecked = 'T'
|
||||
ValueUnchecked = 'F'
|
||||
EditType = etEdit
|
||||
TwoColor = 12648447
|
||||
TwoFontColor = clWindowText
|
||||
end>
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Top = 311
|
||||
Width = 862
|
||||
Height = 41
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 2
|
||||
object Button1: TButton
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 105
|
||||
Height = 25
|
||||
Caption = #29986#29983' Create SQL'
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 120
|
||||
Top = 8
|
||||
Width = 121
|
||||
Height = 25
|
||||
Caption = #29986#29983' ItemTemplate'
|
||||
TabOrder = 1
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 248
|
||||
Top = 8
|
||||
Width = 121
|
||||
Height = 25
|
||||
Caption = #29986#29983' InsertTemplate'
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object ADOConnection1: TADOConnection
|
||||
ConnectionString =
|
||||
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\VS.NET\Thinkyu\D' +
|
||||
'elphi\'#36039#26009#34920'.mdb;Persist Security Info=False'
|
||||
LoginPrompt = False
|
||||
Mode = cmShareDenyNone
|
||||
Provider = 'Microsoft.Jet.OLEDB.4.0'
|
||||
Left = 168
|
||||
Top = 408
|
||||
end
|
||||
object ADODataSet1: TADODataSet
|
||||
Connection = ADOConnection1
|
||||
CursorType = ctStatic
|
||||
AfterScroll = ADODataSet1AfterScroll
|
||||
CommandText = 'SELECT * FROM ['#36039#26009#34920'] ORDER BY ['#34920#26684#21517#31281']'
|
||||
Parameters = <>
|
||||
Left = 272
|
||||
Top = 408
|
||||
end
|
||||
object DataSource1: TDataSource
|
||||
DataSet = ADODataSet1
|
||||
Left = 368
|
||||
Top = 408
|
||||
end
|
||||
object ADODataSet2: TADODataSet
|
||||
Connection = ADOConnection1
|
||||
CursorType = ctStatic
|
||||
CommandText = 'SELECT * FROM ['#27396#20301'] WHERE ['#34920#26684#21517#31281']=:'#34920#26684#21517#31281#13#10'ORDER BY ['#38917#27425']'
|
||||
MasterFields = #34920#26684#21517#31281
|
||||
Parameters = <
|
||||
item
|
||||
Name = #34920#26684#21517#31281
|
||||
Attributes = [paNullable]
|
||||
DataType = ftWideString
|
||||
NumericScale = 255
|
||||
Precision = 255
|
||||
Size = 10
|
||||
Value = 'BCUS'
|
||||
end>
|
||||
Left = 272
|
||||
Top = 480
|
||||
object ADODataSet2DSDesigner: TWideStringField
|
||||
FieldName = #34920#26684#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner2: TSmallintField
|
||||
FieldName = #38917#27425
|
||||
end
|
||||
object ADODataSet2DSDesigner3: TWideStringField
|
||||
FieldName = #27396#20301#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner4: TWideStringField
|
||||
FieldName = #22411#24907
|
||||
Size = 10
|
||||
end
|
||||
object ADODataSet2DSDesigner5: TSmallintField
|
||||
FieldName = #38263#24230
|
||||
end
|
||||
object ADODataSet2DSDesigner6: TSmallintField
|
||||
FieldName = #23567#25976
|
||||
end
|
||||
object ADODataSet2PK: TWideStringField
|
||||
FieldName = 'PK'
|
||||
Size = 1
|
||||
end
|
||||
object ADODataSet2FK: TWideStringField
|
||||
FieldName = 'FK'
|
||||
Size = 1
|
||||
end
|
||||
object ADODataSet2DSDesigner7: TWideStringField
|
||||
FieldName = #20013#25991#21517#31281
|
||||
end
|
||||
object ADODataSet2DSDesigner8: TWideStringField
|
||||
FieldName = #39023#31034#20803#20214
|
||||
end
|
||||
object ADODataSet2DSDesigner9: TWideStringField
|
||||
FieldName = #32232#36655#20803#20214
|
||||
end
|
||||
object ADODataSet2DSDesigner10: TWideStringField
|
||||
FieldName = #20633#35387
|
||||
Size = 255
|
||||
end
|
||||
object ADODataSet2MaxItem: TAggregateField
|
||||
FieldName = 'MaxItem'
|
||||
Active = True
|
||||
Expression = 'MAX('#38917#27425')'
|
||||
end
|
||||
end
|
||||
object DataSource2: TDataSource
|
||||
DataSet = ADODataSet2
|
||||
Left = 368
|
||||
Top = 480
|
||||
end
|
||||
object DataSetProvider1: TDataSetProvider
|
||||
DataSet = ADODataSet2
|
||||
ResolveToDataSet = True
|
||||
Options = [poAutoRefresh]
|
||||
Left = 464
|
||||
Top = 480
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
AggregatesActive = True
|
||||
FetchOnDemand = False
|
||||
Params = <>
|
||||
ProviderName = 'DataSetProvider1'
|
||||
AfterInsert = ClientDataSet1AfterInsert
|
||||
AfterPost = ClientDataSet1AfterPost
|
||||
Left = 552
|
||||
Top = 480
|
||||
object ClientDataSet1CDSDesigner: TWideStringField
|
||||
FieldName = #34920#26684#21517#31281
|
||||
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner2: TSmallintField
|
||||
FieldName = #38917#27425
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner3: TWideStringField
|
||||
FieldName = #27396#20301#21517#31281
|
||||
ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner4: TWideStringField
|
||||
FieldName = #22411#24907
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 10
|
||||
end
|
||||
object ClientDataSet1CDSDesigner5: TSmallintField
|
||||
FieldName = #38263#24230
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner6: TSmallintField
|
||||
FieldName = #23567#25976
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1PK: TWideStringField
|
||||
FieldName = 'PK'
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 1
|
||||
end
|
||||
object ClientDataSet1FK: TWideStringField
|
||||
FieldName = 'FK'
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 1
|
||||
end
|
||||
object ClientDataSet1CDSDesigner7: TWideStringField
|
||||
FieldName = #20013#25991#21517#31281
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner8: TWideStringField
|
||||
FieldName = #39023#31034#20803#20214
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner9: TWideStringField
|
||||
FieldName = #32232#36655#20803#20214
|
||||
ProviderFlags = [pfInUpdate]
|
||||
end
|
||||
object ClientDataSet1CDSDesigner10: TWideStringField
|
||||
FieldName = #20633#35387
|
||||
ProviderFlags = [pfInUpdate]
|
||||
Size = 255
|
||||
end
|
||||
object ClientDataSet1MAXItem: TAggregateField
|
||||
FieldName = 'MAXItem'
|
||||
Active = True
|
||||
Expression = 'MAX('#38917#27425')'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,180 @@
|
||||
unit Unit1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB, ExtCtrls, wdbreg, DBClient,
|
||||
Provider;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
ADOConnection1: TADOConnection;
|
||||
ADODataSet1: TADODataSet;
|
||||
Memo1: TMemo;
|
||||
DataSource1: TDataSource;
|
||||
ADODataSet2: TADODataSet;
|
||||
DataSource2: TDataSource;
|
||||
Panel1: TPanel;
|
||||
DBGrid2: WDBGRID;
|
||||
DBGrid1: WDBGRID;
|
||||
Splitter1: TSplitter;
|
||||
Splitter2: TSplitter;
|
||||
DataSetProvider1: TDataSetProvider;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ClientDataSet1MAXItem: TAggregateField;
|
||||
Panel2: TPanel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
ADODataSet2MaxItem: TAggregateField;
|
||||
ClientDataSet1CDSDesigner: TWideStringField;
|
||||
ClientDataSet1CDSDesigner2: TSmallintField;
|
||||
ClientDataSet1CDSDesigner3: TWideStringField;
|
||||
ClientDataSet1CDSDesigner4: TWideStringField;
|
||||
ClientDataSet1CDSDesigner5: TSmallintField;
|
||||
ClientDataSet1CDSDesigner6: TSmallintField;
|
||||
ClientDataSet1PK: TWideStringField;
|
||||
ClientDataSet1FK: TWideStringField;
|
||||
ClientDataSet1CDSDesigner7: TWideStringField;
|
||||
ClientDataSet1CDSDesigner8: TWideStringField;
|
||||
ClientDataSet1CDSDesigner9: TWideStringField;
|
||||
ClientDataSet1CDSDesigner10: TWideStringField;
|
||||
ADODataSet2DSDesigner: TWideStringField;
|
||||
ADODataSet2DSDesigner2: TSmallintField;
|
||||
ADODataSet2DSDesigner3: TWideStringField;
|
||||
ADODataSet2DSDesigner4: TWideStringField;
|
||||
ADODataSet2DSDesigner5: TSmallintField;
|
||||
ADODataSet2DSDesigner6: TSmallintField;
|
||||
ADODataSet2PK: TWideStringField;
|
||||
ADODataSet2FK: TWideStringField;
|
||||
ADODataSet2DSDesigner7: TWideStringField;
|
||||
ADODataSet2DSDesigner8: TWideStringField;
|
||||
ADODataSet2DSDesigner9: TWideStringField;
|
||||
ADODataSet2DSDesigner10: TWideStringField;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure ListBox1Click(Sender: TObject);
|
||||
procedure ADODataSet1AfterScroll(DataSet: TDataSet);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure ClientDataSet1AfterInsert(DataSet: TDataSet);
|
||||
procedure ClientDataSet1AfterPost(DataSet: TDataSet);
|
||||
private
|
||||
procedure GenerateCreateSQL;
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
var i: integer;
|
||||
begin
|
||||
ADOConnection1.Connected := True;
|
||||
ADODataSet1.Open;
|
||||
ADODataSet2.Open;
|
||||
//ClientDataSet1.Open;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
ADODataSet2.Close;
|
||||
ADODataSet1.Close;
|
||||
ADOConnection1.Connected := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.ListBox1Click(Sender: TObject);
|
||||
begin
|
||||
//if ListBox1.ItemIndex = -1 then
|
||||
// Exit;
|
||||
|
||||
//ADODataSet1.Active := False;
|
||||
//ADODataSet1.CommandText := Format('SELECT * FROM [%S]', [ListBox1.Items[ListBox1.ItemIndex]]);
|
||||
//ADODataSet1.Active := True;
|
||||
|
||||
//GenerateCreateSQL;
|
||||
end;
|
||||
|
||||
procedure TForm1.GenerateCreateSQL;
|
||||
var recno: integer;
|
||||
s: string;
|
||||
fieldName, fieldType: string;
|
||||
aLength, aDecimal: integer;
|
||||
begin
|
||||
Memo1.Lines.Clear;
|
||||
Memo1.Lines.Append(Format('CREATE TABLE %s (', [ADODataSet2.FieldByName('表格名稱').AsString]));
|
||||
|
||||
ClientDataSet1.DisableControls;
|
||||
ClientDataSet1.First;
|
||||
recno := 1;
|
||||
while not ClientDataSet1.Eof do
|
||||
begin
|
||||
fieldName := ClientDataSet1.FieldByName('欄位名稱').AsString;
|
||||
fieldType := ClientDataSet1.FieldByName('型態').AsString;
|
||||
aLength := ClientDataSet1.FieldByName('長度').AsInteger;
|
||||
aDecimal := ClientDataSet1.FieldByName('小數').AsInteger;
|
||||
s := Format(' %s %s', [fieldName, fieldType]);
|
||||
|
||||
if fieldType = 'DECIMAL' then
|
||||
s := s + Format(' (%d, %d)', [aLength, aDecimal])
|
||||
else if Pos(fieldType, 'CHAR,NCHAR,VARCHAR,NVARCHAR') > 0 then
|
||||
s := s + Format(' (%d)', [aLength]);
|
||||
|
||||
if ClientDataSet1.FieldByName('PK').AsString = 'V' then
|
||||
s := s + ' NOT NULL ';
|
||||
|
||||
if recno < ClientDataSet1.RecordCount then
|
||||
s := s + ' ,'
|
||||
else
|
||||
s := s + ' )';
|
||||
Memo1.Lines.Append(s);
|
||||
Inc(recno);
|
||||
ClientDataSet1.MoveBy(1);
|
||||
end;
|
||||
Memo1.Lines.Append('GO');
|
||||
|
||||
ClientDataSet1.First;
|
||||
ClientDataSet1.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TForm1.ADODataSet1AfterScroll(DataSet: TDataSet);
|
||||
begin
|
||||
ClientDataSet1.Close;
|
||||
ADODataSet2.DisableControls;
|
||||
ADODataSet2.Close;
|
||||
ADODataSet2.Parameters.ParamValues['表格名稱'] := ADODataSet1.FieldValues['表格名稱'];
|
||||
ADODataSet2.Open;
|
||||
ClientDataSet1.Open;
|
||||
ADODataSet2.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
begin
|
||||
GenerateCreateSQL;
|
||||
end;
|
||||
|
||||
procedure TForm1.ClientDataSet1AfterInsert(DataSet: TDataSet);
|
||||
begin
|
||||
if VarIsNull(ClientDataSet1.FieldByName('MAXItem').Value) then
|
||||
//ClientDataSet1.FieldByName('項次').AsInteger := 1
|
||||
ADODataSet2.FieldByName('項次').AsInteger := 1
|
||||
else
|
||||
//ClientDataSet1.FieldByName('項次').AsInteger := ClientDataSet1.FieldByName('MAXItem').Value + 1;
|
||||
ADODataSet2.FieldByName('項次').AsInteger := ClientDataSet1.FieldByName('MAXItem').Value + 1;
|
||||
//ClientDataSet1.FieldByName('表格名稱').AsString := ADODataSet1.FieldValues['表格名稱'];
|
||||
ADODataSet2.FieldByName('表格名稱').AsString := ADODataSet1.FieldValues['表格名稱'];
|
||||
end;
|
||||
|
||||
procedure TForm1.ClientDataSet1AfterPost(DataSet: TDataSet);
|
||||
//var i: integer;
|
||||
begin
|
||||
//i := ClientDataSet1.ApplyUpdates(0);
|
||||
end;
|
||||
|
||||
end.
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user