chore: 首次簽入 Thinkyu ASP.NET 專案

- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
2026-09-10 09:42:37 +08:00
commit 577060bc78
2496 changed files with 501389 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
# ------------------------------
# Visual Studio / ASP.NET
# ------------------------------
# 建置結果
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
[Dd]ebug/
[Rr]elease/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Pp]ublish/
PrecompiledWeb/
# Visual Studio 使用者設定
.vs/
*.user
*.rsuser
*.suo
*.docstates.suo
*.userosscache
*.sln.docstates
*.userprefs
# NuGet
packages/
*.nupkg
*.snupkg
!**/packages/build/
!**/packages/repositories.config
*.nuget.props
*.nuget.targets
# 其他 IDE
.idea/
.run/
*.DotSettings.user
# Subversion (此專案曾用 SVN)
.svn/
# ASP.NET / IIS
*.Cache
*.dll.refresh
*.pdb.refresh
*.cache
project.lock.json
project.fragment.lock.json
ClientBin/
_UpgradeReport_Files/
UpgradeLog*.XML
App_Data/*.mdf
App_Data/*.ldf
App_Data/Logs/
# 大型安裝檔(體積過大,不簽入版控)
Web/report/*.msi
# 暫存與備份
*.tmp
*.temp
*.bak
*.orig
*~
*.log
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
+91
View File
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B0221818-B149-4848-925B-C9FE63E3B727}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>BackupClient</RootNamespace>
<AssemblyName>BackupClient</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Web References\BackupService\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://thinkyustaff.com/backup/backupservice.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\BackupService\</RelPath>
<UpdateFromURL>http://thinkyustaff.com/backup/backupservice.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>BackupClient_BackupService_BackupService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\BackupService\backupservice.disco" />
<None Include="Web References\BackupService\backupservice.wsdl" />
<None Include="Web References\BackupService\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BackupClient
{
class Program
{
static void Main(string[] args)
{
var service = new BackupService.BackupService();
string[] files = service.GetFiles(@"h:\root\home\thinkyu-001\www\thinkyu\card\uploadedpicture\rpar_attachment\");
foreach (var file in files)
{
Console.WriteLine(file);
}
Console.ReadLine();
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("BackupClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BackupClient")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設為 false 可對 COM 元件隱藏
// 組件中的類型。若必須從 COM 存取此組件中的類型,
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("b0221818-b149-4848-925b-c9fe63e3b727")]
// 組件的版本資訊由下列四個值所組成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂
//
// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
// 設為預設,如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+36
View File
@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace BackupClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://thinkyustaff.com/backup/backupservice.asmx")]
public string BackupClient_BackupService_BackupService {
get {
return ((string)(this["BackupClient_BackupService_BackupService"]));
}
}
}
}
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BackupClient.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="BackupClient_BackupService_BackupService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://thinkyustaff.com/backup/backupservice.asmx</Value>
</Setting>
</Settings>
</SettingsFile>
@@ -0,0 +1,150 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
//------------------------------------------------------------------------------
//
// 原始程式碼已由 Microsoft.VSDesigner 自動產生,版本 4.0.30319.42000。
//
#pragma warning disable 1591
namespace BackupClient.BackupService {
using System;
using System.Web.Services;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using System.ComponentModel;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3062.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="BackupServiceSoap", Namespace="http://thinkyustaff.com/")]
public partial class BackupService : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback GetFilesOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public BackupService() {
this.Url = global::BackupClient.Properties.Settings.Default.BackupClient_BackupService_BackupService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials {
get {
return base.UseDefaultCredentials;
}
set {
base.UseDefaultCredentials = value;
this.useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event GetFilesCompletedEventHandler GetFilesCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://thinkyustaff.com/GetFiles", RequestNamespace="http://thinkyustaff.com/", ResponseNamespace="http://thinkyustaff.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string[] GetFiles(string path) {
object[] results = this.Invoke("GetFiles", new object[] {
path});
return ((string[])(results[0]));
}
/// <remarks/>
public void GetFilesAsync(string path) {
this.GetFilesAsync(path, null);
}
/// <remarks/>
public void GetFilesAsync(string path, object userState) {
if ((this.GetFilesOperationCompleted == null)) {
this.GetFilesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetFilesOperationCompleted);
}
this.InvokeAsync("GetFiles", new object[] {
path}, this.GetFilesOperationCompleted, userState);
}
private void OnGetFilesOperationCompleted(object arg) {
if ((this.GetFilesCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetFilesCompleted(this, new GetFilesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
}
private bool IsLocalFileSystemWebService(string url) {
if (((url == null)
|| (url == string.Empty))) {
return false;
}
System.Uri wsUri = new System.Uri(url);
if (((wsUri.Port >= 1024)
&& (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
return true;
}
return false;
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3062.0")]
public delegate void GetFilesCompletedEventHandler(object sender, GetFilesCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3062.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetFilesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal GetFilesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public string[] Result {
get {
this.RaiseExceptionIfNecessary();
return ((string[])(this.results[0]));
}
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://thinkyustaff.com/backup/backupservice.asmx?disco" filename="backupservice.disco" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://thinkyustaff.com/backup/backupservice.asmx?wsdl" filename="backupservice.wsdl" />
</Results>
</DiscoveryClientResultsFile>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://thinkyustaff.com/backup/backupservice.asmx?wsdl" docRef="http://thinkyustaff.com/backup/backupservice.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://thinkyustaff.com/backup/backupservice.asmx" xmlns:q1="http://thinkyustaff.com/" binding="q1:BackupServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://thinkyustaff.com/backup/backupservice.asmx" xmlns:q2="http://thinkyustaff.com/" binding="q2:BackupServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://thinkyustaff.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://thinkyustaff.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://thinkyustaff.com/">
<s:element name="GetFiles">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="path" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetFilesResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetFilesResult" type="tns:ArrayOfString" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="GetFilesSoapIn">
<wsdl:part name="parameters" element="tns:GetFiles" />
</wsdl:message>
<wsdl:message name="GetFilesSoapOut">
<wsdl:part name="parameters" element="tns:GetFilesResponse" />
</wsdl:message>
<wsdl:portType name="BackupServiceSoap">
<wsdl:operation name="GetFiles">
<wsdl:input message="tns:GetFilesSoapIn" />
<wsdl:output message="tns:GetFilesSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BackupServiceSoap" type="tns:BackupServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetFiles">
<soap:operation soapAction="http://thinkyustaff.com/GetFiles" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="BackupServiceSoap12" type="tns:BackupServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetFiles">
<soap12:operation soapAction="http://thinkyustaff.com/GetFiles" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="BackupService">
<wsdl:port name="BackupServiceSoap" binding="tns:BackupServiceSoap">
<soap:address location="http://thinkyustaff.com/backup/backupservice.asmx" />
</wsdl:port>
<wsdl:port name="BackupServiceSoap12" binding="tns:BackupServiceSoap12">
<soap12:address location="http://thinkyustaff.com/backup/backupservice.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="BackupClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<BackupClient.Properties.Settings>
<setting name="BackupClient_BackupService_BackupService" serializeAs="String">
<value>http://thinkyustaff.com/backup/backupservice.asmx</value>
</setting>
</BackupClient.Properties.Settings>
</applicationSettings>
</configuration>
+1
View File
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="BackupService.asmx.cs" Class="BackupService.BackupService" %>
+103
View File
@@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Web.Script.Services;
using System.Data;
using System.Text;
using System.IO.Compression;
namespace BackupService
{
/// <summary>
///BackupService 的摘要描述
/// </summary>
[WebService(Namespace = "https://thinkyustaff.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class BackupService : System.Web.Services.WebService
{
[WebMethod]
public string BackupTable()
{
string filePath = Server.MapPath("~/SQL");
Directory.CreateDirectory(filePath);
BackupWorker worker = new BackupWorker();
worker.DataPath = filePath;
worker.Begin();
return "OK";
}
[WebMethod]
public string BackupOneTable(string tableName)
{
string filePath = Server.MapPath("~/SQL");
Directory.CreateDirectory(filePath);
BackupWorker worker = new BackupWorker();
worker.DataPath = filePath;
worker.BackupOneTable(tableName);
return "OK";
}
[WebMethod]
[ScriptMethod]
public List<FileList> GetFileList(string path)
{
var result = new List<FileList>();
ListFiles(path, result);
return result;
}
private void ListFiles(string path, List<FileList> fileLists)
{
var newPath = new FileList();
newPath.Path = path;
foreach (var file in Directory.GetFiles(path))
{
newPath.FileNames.Add(Path.GetFileName(file));
}
fileLists.Add(newPath);
foreach (var dir in Directory.GetDirectories(path))
{
ListFiles(dir, fileLists);
}
}
[WebMethod]
[ScriptMethod]
public string GetFile(string path)
{
return Convert.ToBase64String(File.ReadAllBytes(path));
}
[Serializable]
public class FileList
{
public string Path { get; set; }
public List<string> FileNames { get; set; }
public FileList()
{
FileNames = new List<string>();
}
}
public class TableItem
{
public string TableName { get; set; }
public bool HasIdentity { get; set; }
}
}
}
+113
View File
@@ -0,0 +1,113 @@
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A42DA595-C6E4-4658-8790-F6364DF91F84}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BackupService</RootNamespace>
<AssemblyName>BackupService</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="BackupService.asmx" />
<Content Include="Global.asax" />
<Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="BackupService.asmx.cs">
<DependentUpon>BackupService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="BackupWorker.cs" />
<Compile Include="ErrorLogger.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>49336</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:49336/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+254
View File
@@ -0,0 +1,254 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Timers;
using System.IO;
using System.Data.SqlClient;
using static BackupService.BackupService;
using System.Text;
using System.Data;
using System.IO.Compression;
namespace BackupService
{
public class BackupWorker
{
private string dataPath = null;
private Timer timer = null;
private string fromTable = null;
public BackupWorker()
{
timer = new Timer();
timer.AutoReset = false;
timer.Interval = 1000;
timer.Enabled = false;
timer.Elapsed += new ElapsedEventHandler(DoWork);
}
public string DataPath
{
get { return dataPath; }
set { dataPath = value; }
}
public void Begin(string fromTable = null)
{
this.fromTable = fromTable;
timer.Start();
}
public void BackupOneTable(string tableName)
{
var nowtime = DateTime.UtcNow.AddHours(8);
try
{
using (var conn = new SqlConnection("Data Source=sql5060.site4now.net;Initial Catalog=DB_A48A46_thinkyu;Persist Security Info=True;User ID=DB_A48A46_thinkyu_admin;Password=VUPm4ej03xu3"))
{
conn.Open();
var cmd = new SqlCommand();
var da = new SqlDataAdapter();
cmd.Connection = conn;
cmd.CommandText = @"SELECT INFORMATION_SCHEMA.TABLES.TABLE_NAME, Count(sys.identity_columns.Column_ID) as HAS_IDENTITY
FROM INFORMATION_SCHEMA.TABLES
LEFT JOIN sys.identity_columns on OBJECT_NAME(object_id) = INFORMATION_SCHEMA.TABLES.TABLE_NAME
WHERE TABLE_TYPE <> 'VIEW' and INFORMATION_SCHEMA.TABLES.TABLE_NAME = @TABLE_NAME
GROUP BY INFORMATION_SCHEMA.TABLES.TABLE_NAME";
cmd.Parameters.AddWithValue("TABLE_NAME", tableName);
var tableList = new List<TableItem>();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
tableList.Add(new TableItem() { TableName = Convert.ToString(reader["TABLE_NAME"]), HasIdentity = Convert.ToInt32(reader["HAS_IDENTITY"]) == 1 });
}
}
foreach (var table in tableList)
{
var output = new StringBuilder();
var columnnames = new List<string>();
cmd.CommandText = "select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=@TABLE_NAME order by ORDINAL_POSITION ";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("TABLE_NAME", table.TableName);
da.SelectCommand = cmd;
var columns = new DataTable();
da.Fill(columns);
foreach (DataRow row in columns.Rows)
{
columnnames.Add(string.Format("[{0}]", row["COLUMN_NAME"]));
}
var columnlist = string.Join(", ", columnnames.ToArray());
output.AppendFormat("-- BACKUP DATE {0:yyyy/MM/dd HH:mm}\r\n", nowtime);
output.AppendFormat("-- TABLE [{0}]\r\n", table.TableName);
if (table.HasIdentity)
output.AppendFormat("set identity_insert [{0}] on;\r\n", table.TableName);
cmd.CommandText = string.Format("select * from [{0}]", table.TableName);
cmd.CreateParameter();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
var sql = string.Format("insert into [{0}] ({1}) values (", table.TableName, columnlist);
var values = new List<string>();
foreach (DataRow col in columns.Rows)
{
var colname = Convert.ToString(col["COLUMN_NAME"]);
var datatype = Convert.ToString(col["DATA_TYPE"]).ToLower();
var value = reader[colname];
if (value == DBNull.Value)
values.Add("null");
else if (datatype == "char" || datatype == "varchar")
values.Add(string.Format("'{0}'", value));
else if (datatype == "nvarchar" || datatype == "nchar")
values.Add(string.Format("N'{0}'", value));
else if (datatype == "nvarchar" || datatype == "datetime")
values.Add(string.Format("'{0:yyyy/MM/dd HH:mm:ss.fff}'", value));
else if (datatype == "bit")
values.Add(string.Format("{0}", value));
else
values.Add(string.Format("{0}", value));
}
sql += string.Join(", ", values.ToArray()) + ");";
output.AppendLine(sql);
}
}
if (table.HasIdentity)
output.AppendFormat("set identity_insert [{0}] off;\r\n", table.TableName);
var buffer = Encoding.UTF8.GetBytes(output.ToString());
using (FileStream stream = new FileStream(string.Format("{0}/{1}.gz", dataPath, table.TableName), FileMode.Create, FileAccess.Write))
{
using (GZipStream gZip = new GZipStream(stream, CompressionMode.Compress))
{
gZip.Write(buffer, 0, buffer.Length);
}
}
}
}
}
catch (Exception ex)
{
ErrorLogger.WriteException(ex);
}
}
private void DoWork(object sender, ElapsedEventArgs e)
{
var nowtime = DateTime.UtcNow.AddHours(8);
try
{
using (var conn = new SqlConnection("Data Source=sql5060.site4now.net;Initial Catalog=DB_A48A46_thinkyu;Persist Security Info=True;User ID=DB_A48A46_thinkyu_admin;Password=VUPm4ej03xu3"))
{
conn.Open();
var cmd = new SqlCommand();
var da = new SqlDataAdapter();
cmd.Connection = conn;
cmd.CommandText = @"SELECT INFORMATION_SCHEMA.TABLES.TABLE_NAME, Count(sys.identity_columns.Column_ID) as HAS_IDENTITY
FROM INFORMATION_SCHEMA.TABLES
LEFT JOIN sys.identity_columns on OBJECT_NAME(object_id) = INFORMATION_SCHEMA.TABLES.TABLE_NAME
WHERE TABLE_TYPE <> 'VIEW'
GROUP BY INFORMATION_SCHEMA.TABLES.TABLE_NAME";
var tableList = new List<TableItem>();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
string tableName = Convert.ToString(reader["TABLE_NAME"]);
bool hasIdentity = Convert.ToInt32(reader["HAS_IDENTITY"]) == 1;
if (string.IsNullOrEmpty(this.fromTable) || tableName.CompareTo(this.fromTable) >= 0) {
tableList.Add(new TableItem() { TableName = tableName, HasIdentity = hasIdentity });
}
}
}
foreach (var table in tableList)
{
var output = new StringBuilder();
var columnnames = new List<string>();
cmd.CommandText = "select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME=@TABLE_NAME order by ORDINAL_POSITION ";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("TABLE_NAME", table.TableName);
da.SelectCommand = cmd;
var columns = new DataTable();
da.Fill(columns);
foreach (DataRow row in columns.Rows)
{
columnnames.Add(string.Format("[{0}]", row["COLUMN_NAME"]));
}
var columnlist = string.Join(", ", columnnames.ToArray());
output.AppendFormat("-- BACKUP DATE {0:yyyy/MM/dd HH:mm}\r\n", nowtime);
output.AppendFormat("-- TABLE [{0}]\r\n", table.TableName);
if (table.HasIdentity)
output.AppendFormat("set identity_insert [{0}] on;\r\n", table.TableName);
cmd.CommandText = string.Format("select * from [{0}]", table.TableName);
cmd.CreateParameter();
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
var sql = string.Format("insert into [{0}] ({1}) values (", table.TableName, columnlist);
var values = new List<string>();
foreach (DataRow col in columns.Rows)
{
var colname = Convert.ToString(col["COLUMN_NAME"]);
var datatype = Convert.ToString(col["DATA_TYPE"]).ToLower();
var value = reader[colname];
if (value == DBNull.Value)
values.Add("null");
else if (datatype == "char" || datatype == "varchar")
values.Add(string.Format("'{0}'", value));
else if (datatype == "nvarchar" || datatype == "nchar")
values.Add(string.Format("N'{0}'", value));
else if (datatype == "nvarchar" || datatype == "datetime")
values.Add(string.Format("'{0:yyyy/MM/dd HH:mm:ss.fff}'", value));
else if (datatype == "bit")
values.Add(string.Format("{0}", value));
else
values.Add(string.Format("{0}", value));
}
sql += string.Join(", ", values.ToArray()) + ");";
output.AppendLine(sql);
}
}
if (table.HasIdentity)
output.AppendFormat("set identity_insert [{0}] off;\r\n", table.TableName);
var buffer = Encoding.UTF8.GetBytes(output.ToString());
using (FileStream stream = new FileStream(string.Format("{0}/{1}.gz", dataPath, table.TableName), FileMode.Create, FileAccess.Write))
{
using (GZipStream gZip = new GZipStream(stream, CompressionMode.Compress))
{
gZip.Write(buffer, 0, buffer.Length);
}
}
}
}
}
catch (Exception ex)
{
ErrorLogger.WriteException(ex);
}
}
}
}
+63
View File
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BackupService
{
public class ErrorLogger
{
private const string Message1 = @"錯誤類別:{0}
錯誤來源:{1}
錯誤訊息:{2}
堆疊內容:
{3}
";
private const string Message2 = @"以上的錯誤發生的原因是:
錯誤類別:{0}
錯誤來源:{1}
錯誤訊息:{2}
堆疊內容:
{3}
";
private static string logPath = null;
public static string LogPath
{
get { return ErrorLogger.logPath; }
set { ErrorLogger.logPath = value; }
}
public static void WriteException(Exception ex)
{
// 發生未處理錯誤時執行的程式碼
string Message = "";
Message += String.Format(ErrorLogger.Message1,
ex.GetType().FullName,
ex.Source,
ex.Message,
ex.StackTrace);
ex = ex.InnerException;
while (ex != null)
{
Message += String.Format(ErrorLogger.Message2,
ex.GetType().FullName,
ex.Source,
ex.Message,
ex.StackTrace);
ex = ex.InnerException;
}
//寫入文字檔
string fileName = DateTime.UtcNow.AddHours(8).ToString("yyyyMMdd_HHmmss");
System.IO.File.AppendAllText(string.Format(@"{0}/{1}.txt", ErrorLogger.logPath, fileName), Message);
}
}
}
+1
View File
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="BackupService.Global" Language="C#" %>
+53
View File
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
namespace BackupService
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
string logPath = Server.MapPath("~/LOG");
Directory.CreateDirectory(logPath);
ErrorLogger.LogPath = logPath;
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
ErrorLogger.WriteException(Server.GetLastError());
Server.ClearError();
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
}
+35
View File
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 組件的一般資訊是由下列的屬性集
// 控制。變更這些屬性值可修改與組件關聯的
// 資訊。
[assembly: AssemblyTitle("BackupService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BackupService")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 將 ComVisible 設定為 false 會使得這個組件中的型別
// 對 COM 元件而言為不可見。如果您需要從 COM 存取此組件中
// 的型別,請在該型別上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("a42da595-c6e4-4658-8790-f6364df91f84")]
// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將修訂和組建編號
// 指定為預設值:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
此檔案由您的 Web 專案發佈/封裝處理序使用。您可以藉由編輯此 MSBuild 檔案,
自訂此處理序的行為。若要深入了解,請前往 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>D:\VS.NET\Thinkyu\BackupServiceRelease</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 如需使用 web.config 轉換的詳細資訊,請前往 https://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
在下面的範例中,"SetAttributes" 轉換只會在 "Match" 定位程式找到
值為 "MyDB" 的屬性 "name" 時,才將 "connectionString" 的值變
更為使用 "ReleaseSQLServer"。
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<!--
在下面的範例中,"Replace" 轉換將會取代 web.config 檔案
的整個 <customErrors> 區段。
請注意,因為在 <system.web> 節點之下
只有一個 customErrors 區段,所以不需要使用 "xdt:Locator" 屬性。
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 如需使用 web.config 轉換的詳細資訊,請前往 https://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<!--
在下面的範例中,"SetAttributes" 轉換只會在 "Match" 定位程式找到
值為 "MyDB" 的屬性 "name" 時,才將 "connectionString" 的值變
更為使用 "ReleaseSQLServer"。
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<!--
在下面的範例中,"Replace" 轉換將會取代 web.config 檔案
的整個 <customErrors> 區段。
請注意,因為在 <system.web> 節點之下
只有一個 customErrors 區段,所以不需要使用 "xdt:Locator" 屬性。
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
</configuration>
+109
View File
@@ -0,0 +1,109 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
<authentication> 區段可讓您設定
ASP.NET 用來識別連入使用者的
安全性驗證模式。
-->
<authentication mode="Windows"/>
<!--
<customErrors> 區段可讓您設定
當執行要求期間發生無法處理
之錯誤時的處理方式。更明確地說,
開發人員可以利用它設定要顯示的
html 錯誤頁面,以取代錯誤堆疊追蹤。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpRuntime executionTimeout="600"/>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>
<!--
在 Internet Information Services 7.0 下,需要有 system.webServer 區段才能執行
ASP.NET AJAX。在舊版 IIS 下則不需要。
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1048576000"/>
</webServices>
</scripting>
</system.web.extensions>
<runtime>
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+1
View File
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="BackupService.asmx.cs" Class="BackupService.BackupService" %>
+1
View File
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="BackupService.Global" Language="C#" %>
+110
View File
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings />
<connectionStrings />
<system.web>
<compilation>
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<!--
<authentication> 區段可讓您設定
ASP.NET 用來識別連入使用者的
安全性驗證模式。
-->
<authentication mode="Windows" />
<!--
<customErrors> 區段可讓您設定
當執行要求期間發生無法處理
之錯誤時的處理方式。更明確地說,
開發人員可以利用它設定要顯示的
html 錯誤頁面,以取代錯誤堆疊追蹤。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</controls>
</pages>
<httpRuntime executionTimeout="600" />
<httpHandlers>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<!--
在 Internet Information Services 7.0 下,需要有 system.webServer 區段才能執行
ASP.NET AJAX。在舊版 IIS 下則不需要。
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ScriptHandlerFactory" />
<remove name="ScriptHandlerFactoryAppServices" />
<remove name="ScriptResource" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
</system.webServer>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="1048576000" />
</webServices>
</scripting>
</system.web.extensions>
<runtime>
<assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<!--ProjectGuid: A42DA595-C6E4-4658-8790-F6364DF91F84-->
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
DELETE FROM BPAA;
DELETE FROM BPAB;
DELETE FROM BPAC;
DELETE FROM BPJA;
DELETE FROM BPJB;
DELETE FROM BPSN;
DELETE FROM BPRJ;
DELETE FROM BPRP;
DELETE FROM BPSN;
DELETE FROM RASN;
DELETE FROM RPAR;
DELETE FROM RPFE;
DELETE FROM RPIR;
DELETE FROM RSAJ;
DELETE FROM SACD;
DELETE FROM SSMS;
+21
View File
@@ -0,0 +1,21 @@
--取得客戶專案、年度專案編號、派遣人員編號的關係
SELECT A.BPPNM, B.BPPYN, C.RANUM
FROM BPRJ A
INNER JOIN BPAA B ON A.BPPNM=B.BPPNM
INNER JOIN RASN C ON B.BPPYN=C.RAPYN
WHERE B.BPYER=97
-- 查 加班 累積補休
select RPREN AS 加班單號, RPRDT AS 日期, RPRTM AS 開始時間, RPETM AS 結束時間, RPDOC 備註, RPTCT 時數, RPUST 已沖
from RPAR WHERE RPTYP='11' AND RPNUM='00989'
-- 查 請假 補休
select RPREN AS 請假單號, RPRDT AS 日期, RPRTM AS 開始時間, RPETM AS 結束時間, RPDOC 備註, RPTCT 時數, RPUST 已沖
from RPAR WHERE RPTYP='00' AND RPNUM='00989'
-- 查 沖補休
SELECT RPREN AS 請假單號, RPREX AS 加班單號, RPTCT AS 沖銷時數 FROM RPAC WHERE RPREN= '2012061090'
SELECT RPREN AS 請假單號, RPREX AS 加班單號, RPTCT AS 沖銷時數 FROM RPAC WHERE RPREN= '2012071108'
SELECT RPREN AS 請假單號, RPREX AS 加班單號, RPTCT AS 沖銷時數 FROM RPAC WHERE RPREN= '2012071235'
+2209
View File
File diff suppressed because it is too large Load Diff
+36
View File
@@ -0,0 +1,36 @@
BPSN
01243 貓老大 Maolaoda M NULL NULL 1 NULL 1 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1 NULL NULL NULL NULL 3 2013-10-01 00:00:00.000 NULL  2013-10-19 11:47:57.120 INSERT 00002 1 NULL NULL 0.00 1 NULL NULL X NULL NULL NULL NULL NULL NULL
BCUS
AG0002 測試機關 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 2013-10-19 11:48:24.487 INSERT 00002 1
BPRJ
2013-10-19 11:55:41.653 INSERT 00002 AG0002 JYAGJ999 測試專案(展譽) NULL NULL NULL NULL NULL N 1.3333 1.6666 1 1 NULL NULL A004 B001 JY
2013-10-19 11:53:45.003 INSERT 00002 AG0002 TYAGJ999 測試專案(新譽) NULL NULL NULL NULL NULL N 1.3333 1.6666 1 1 NULL NULL A004 B001 TY
BPJA
2013-10-19 11:59:43.547 INSERT 00002 102JYAGJ999 01 工讀生 1 10
2013-10-19 12:00:31.013 INSERT 00002 102TYAGJ999 01 工讀生 1 10
BPJB
2013-10-19 12:00:06.207 INSERT 00002 102JYAGJ999 01 01 首席 50000.00 300.00 3000.00 1800.00 0.00 0.00 0.00 1
2013-10-19 12:00:48.660 INSERT 00002 102TYAGJ999 01 01 特級 45000.00 380.00 3000.00 1800.00 0.00 0.00 0.00 1
BPAA
2013-10-19 11:58:12.327 INSERT 00002 JYAGJ999 102 102JYAGJ999 102年度測試專案(展譽) 1000000 1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 31 NULL 1
2013-10-19 11:57:15.097 INSERT 00002 TYAGJ999 102 102TYAGJ999 102年度測試專案(新譽) 1000000 1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 31 NULL 1
BPRM
NULL NULL NULL JYAGJ999 00002 1
NULL NULL NULL TYAGJ999 00002 1
RASN
2013-10-19 12:07:15.913 UPDATE NULL 01243 1 AG0002 102JYAGJ999 2013-10-01 00:00:00.000 2013-10-10 00:00:00.000 0001 NULL 2 01 01
2013-10-19 12:09:39.070 UPDATE NULL 01243 2 AG0002 102TYAGJ999 2013-10-15 00:00:00.000 2013-10-20 00:00:00.000 0001 NULL 2 01 01
RPIR
2013-10-19 13:22:38.883 UPDATE 00002 2013100012 01243 2013-10-01 00:00:00.000 NULL 50000 0 0 0 N 1 2 Y Y 4 0 0 0 NULL 0 50000 JY
2013-10-19 12:48:31.200 UPDATE 00002 2013100013 01243 2013-10-15 00:00:00.000 NULL 50000 0 0 0 N 1 2 Y Y 3 0 0 0 NULL 0 50000 TY
RPIB
2013-10-19 13:24:55.720 INSERT 00002 2013100012 1 01243 2013-10-10 00:00:00.000 2013-10-01 00:00:00.000 2013-10-10 00:00:00.000 50000 50000 0 0 0 0 0 0 0 N 1 2 Y Y NULL 1 JY
+2
View File
@@ -0,0 +1,2 @@
UPDATE BPSN SET BPAWD=''
UPDATE BWEX SET BSNAM='1.表示有權限' WHERE BSNUM='UNMWETA' AND BSITM=' 1'
+23
View File
@@ -0,0 +1,23 @@
declare @ int
set @=52
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where =@
delete from dbo. where in (select from dbo. where =@)
delete from dbo. where =@
delete from dbo.滿調 where =@
delete from dbo.滿調 where =@
delete from dbo.滿調 where =@
+38
View File
@@ -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
+136
View File
@@ -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=vclx;vcl;rtl;indy;dsnapcon;dsnap;dbrtl;vcldb;VclSmp;adortl;bdertl;vcldbx;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;Comm;dclOffice2k;WLib70;TntUnicodeVcl_R70;vclshlctrlsW
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=C:\Program Files\Borland\Delphi7\Bin\
[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=
+13
View File
@@ -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.
+10
View File
@@ -0,0 +1,10 @@
[Stats]
EditorSecs=43
DesignerSecs=22
InspectorSecs=1
CompileSecs=5147
OtherSecs=29
StartTime=2008/1/28 15:50:17
RealKeys=0
EffectiveKeys=0
DebugSecs=1
Binary file not shown.
+81
View File
@@ -0,0 +1,81 @@
object Form1: TForm1
Left = 192
Top = 121
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 16
Top = 72
Width = 657
Height = 353
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object ADOConnection1: TADOConnection
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VS.NET\Thinkyu\D' +
'oc\'#21729#24037#36039#26009#34920'excel_1.xls;Extended Properties="EXCEL 8.0;HDR=0;IMEX=1"' +
';Persist Security Info=False'
KeepConnection = False
LoginPrompt = False
Mode = cmShareDenyNone
Provider = 'Microsoft.Jet.OLEDB.4.0'
Left = 40
Top = 16
end
object ADODataSet1: TADODataSet
Connection = ADOConnection1
CursorType = ctStatic
CommandText = 'select * from ['#21729#24037#36039#26009#34920'excel$]'
Parameters = <>
Left = 128
Top = 16
end
object DataSource1: TDataSource
DataSet = ADODataSet2
Left = 216
Top = 16
end
object ADOConnection2: TADOConnection
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\VS.NET\Thinkyu\D' +
'oc\'#21729#24037#36039#26009#34920'.mdb;Persist Security Info=False'
KeepConnection = False
LoginPrompt = False
Provider = 'Microsoft.Jet.OLEDB.4.0'
Left = 328
Top = 16
end
object ADOCommand1: TADOCommand
CommandText = 'DELETE FROM ['#21729#24037#36039#26009']'
Connection = ADOConnection2
Parameters = <>
Left = 416
Top = 16
end
object ADODataSet2: TADODataSet
Connection = ADOConnection2
CursorType = ctStatic
CommandText = 'select * from ['#21729#24037#36039#26009']'
Parameters = <>
Left = 504
Top = 16
end
end
+116
View File
@@ -0,0 +1,116 @@
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ADODB, DB, Grids, DBGrids;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
ADODataSet1: TADODataSet;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOConnection2: TADOConnection;
ADOCommand1: TADOCommand;
ADODataSet2: TADODataSet;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
function CdatetoEdate(adate: string): string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.CdatetoEdate(adate: string): string;
begin
if adate = '' then
Result := ''
else
Result := FormatDateTime('yyyy/mm/dd',
EncodeDate(StrToInt(Copy(adate, 1, 2)) + 1911, StrToInt(Copy(adate, 4, 2)), StrToInt(Copy(adate, 7, 2))));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ADOConnection1.Connected := True;
ADODataSet1.Open;
ADOConnection2.Connected := True;
ADOCommand1.Execute;
ADODataSet2.Open;
while not ADODataSet1.Eof do
begin
ADODataSet2.Append;
ADODataSet2.FieldByName('員工編號').Value := ADODataSet1.FieldValues['A'];
ADODataSet2.FieldByName('員工姓名').Value := ADODataSet1.FieldValues['B'];
ADODataSet2.FieldByName('性別' ).Value := ADODataSet1.FieldValues['C'];
ADODataSet2.FieldByName('轉存方式').Value := ADODataSet1.FieldValues['D'];
ADODataSet2.FieldByName('到職日' ).AsString := CdatetoEdate(VarToStr(ADODataSet1.FieldValues['E']));
ADODataSet2.FieldByName('底薪' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['F']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('薪資別' ).Value := ADODataSet1.FieldValues['G'];
ADODataSet2.FieldByName('行號' ).Value := ADODataSet1.FieldValues['H'];
ADODataSet2.FieldByName('英文全名').Value := ADODataSet1.FieldValues['I'];
ADODataSet1.MoveBy(1);
ADODataSet2.FieldByName('職務' ).Value := ADODataSet1.FieldValues['A'];
ADODataSet2.FieldByName('職務名稱' ).Value := ADODataSet1.FieldValues['B'];
ADODataSet2.FieldByName('出生日期' ).AsString := CdatetoEdate(VarToStr(ADODataSet1.FieldValues['C']));
ADODataSet2.FieldByName('投保身份' ).Value := ADODataSet1.FieldValues['D'];
ADODataSet2.FieldByName('離職日' ).AsString := CdatetoEdate(VarToStr(ADODataSet1.FieldValues['E']));
ADODataSet2.FieldByName('加班費' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['F']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('帳號' ).Value := ADODataSet1.FieldValues['G'];
ADODataSet2.FieldByName('固定稅率' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['H']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('聯絡電話一').Value := ADODataSet1.FieldValues['I'];
ADODataSet1.MoveBy(1);
ADODataSet2.FieldByName('部門' ).Value := ADODataSet1.FieldValues['A'];
ADODataSet2.FieldByName('部門名稱' ).Value := ADODataSet1.FieldValues['B'];
ADODataSet2.FieldByName('身份證字號').Value := ADODataSet1.FieldValues['C'];
ADODataSet2.FieldByName('勞保卡號' ).Value := ADODataSet1.FieldValues['D'];
ADODataSet2.FieldByName('退休日' ).AsString := CdatetoEdate(VarToStr(ADODataSet1.FieldValues['E']));
ADODataSet2.FieldByName('全勤獎金' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['F']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('課稅方式' ).Value := ADODataSet1.FieldValues['G'];
ADODataSet2.FieldByName('固定稅額' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['H']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('聯絡電話二').Value := ADODataSet1.FieldValues['I'];
ADODataSet1.MoveBy(1);
ADODataSet2.FieldByName('職等' ).Value := ADODataSet1.FieldValues['A'];
ADODataSet2.FieldByName('職等名稱' ).Value := ADODataSet1.FieldValues['B'];
ADODataSet2.FieldByName('婚姻狀況' ).Value := ADODataSet1.FieldValues['C'];
ADODataSet2.FieldByName('健保號碼' ).Value := ADODataSet1.FieldValues['D'];
ADODataSet2.FieldByName('資遣日' ).AsString := CdatetoEdate(VarToStr(ADODataSet1.FieldValues['E']));
ADODataSet2.FieldByName('退休金制度').Value := ADODataSet1.FieldValues['F'];
ADODataSet2.FieldByName('戶籍地址' ).Value := ADODataSet1.FieldValues['G'];
ADODataSet1.MoveBy(1);
ADODataSet2.FieldByName('學歷' ).Value := ADODataSet1.FieldValues['A'];
ADODataSet2.FieldByName('補助等級' ).Value := ADODataSet1.FieldValues['B'];
ADODataSet2.FieldByName('年資' ).Value := StringReplace(VarToStr(ADODataSet1.FieldValues['C']), ',', '', [rfReplaceAll, rfIgnoreCase]);
ADODataSet2.FieldByName('提繳身份別').Value := ADODataSet1.FieldValues['D'];
ADODataSet2.FieldByName('通訊地址' ).Value := ADODataSet1.FieldValues['G'];
ADODataSet1.MoveBy(1);
ADODataSet2.Post;
end;
ADOConnection1.Connected := False;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ADOConnection2.Connected := False;
end;
end.
+38
View File
@@ -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
+136
View File
@@ -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=
+13
View File
@@ -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.
+10
View File
@@ -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
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+454
View File
@@ -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
+189
View File
@@ -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.
BIN
View File
Binary file not shown.
+453
View File
@@ -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
+180
View File
@@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
DECLARE @RPENO NVARCHAR(20)
SET @RPENO='01642'
--取出累積補休資料
SELECT * FROM RPAR WHERE RPNUM=@RPENO AND (RPTYP = '11' OR RPTYP = '13') AND RPRDT > '2017/7/1'
--取出補休沖銷記錄
SELECT * FROM RPAC WHERE RPREX IN
(SELECT RPREN FROM RPAR WHERE RPNUM=@RPENO AND (RPTYP = '11' OR RPTYP = '13') AND RPRDT > '2017/7/1')
SELECT * FROM RPAR WHERE RPREN='2017090727'
--UPDATE RPAR SET RPUST=0 WHERE RPREN='2017080752'
--UPDATE RPAR SET RPUST=0 WHERE RPREN='2017080861'
--UPDATE RPAR SET RPUST=0 WHERE RPREN='2017090512'
--DELETE FROM RPAC WHERE RPREN='2017090727'
--SELECT * FROM RPAC WHERE RPREN='2017090727'
+5
View File
@@ -0,0 +1,5 @@
INSERT INTO BCLS (BSPAR, BSCLS, BSSCR, BLOCK, TRDAT, TRMOD, TRUSR, BSRMK, DB_APPNO) VALUES (N'±Â½Ò°Ï°ì', 'C1', '®ç¶é', '', GETDATE(), 'INSERT', '', '', 1);
INSERT INTO BCLS (BSPAR, BSCLS, BSSCR, BLOCK, TRDAT, TRMOD, TRUSR, BSRMK, DB_APPNO) VALUES (N'±Â½Ò°Ï°ì', 'C2', '·s¦Ë', '', GETDATE(), 'INSERT', '', '', 1);
INSERT INTO BCLS (BSPAR, BSCLS, BSSCR, BLOCK, TRDAT, TRMOD, TRUSR, BSRMK, DB_APPNO) VALUES (N'±Â½Ò°Ï°ì', 'C3', '­]®ß', '', GETDATE(), 'INSERT', '', '', 1);
update BCLS set BSPAR=N'--±Â½Ò°Ï°ì' where BSPAR=N'±Â½Ò°Ï°ì' and BSCLS='C'
update Á¿®v set ±Â½Ò°Ï°ì=REPLACE(±Â½Ò°Ï°ì, 'C', 'C1,C2,C3') where ±Â½Ò°Ï°ì like '%C%'
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
'N':國定假日或民俗假
'H':例假日
'V':彈性放假
'B':補班
'-':上班日
1 2 3
1234567890123456789012345678901
N---HH-----HH-----HH-----HH----
-HH--NNNNHV----HH-----HH---N-
HH-----HH-----HH-----HH-----HH-
---NHH-----HH-----HH-----HH---
N-HH-----HH-----HH-----HH-----H
H-----HH-----HH-----HH-----HH-
----HH-----HH-----HH-----HH----
-HH-----HH-----HH-----HH-----HH
-----HH-----HH-----HH-----HH--
---HH----NHH-----HH-----HH-----
HH-----HH-----HH-----HH-----HH
-----HH-----HH-----HH-----HH---
N---HH-----HH-----HH-----HH-----HH--NNNNHV----HH-----HH---N-HH-----HH-----HH-----HH-----HH----NHH-----HH-----HH-----HH---N-HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH----NHH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH-----HH---
Binary file not shown.
Binary file not shown.
+48
View File
@@ -0,0 +1,48 @@
//六大類別
var bigcat_code=['10000','20000','30000','50000','60000', '70000' ,'0'];
var bigcat_name=['電腦類別','語言類別','管理類別','留遊學類別','國家考試類別','推廣教育類別','技能培訓類別'];
//電腦第二層
var com_code=['10100','10200','10600','10400','10700','10300','10500','10900','11000','11100','11200'];
var com_name=['作業系統','入門基礎','程式語言','網頁設計','網路管理','辦公室應用','多媒體繪圖','企業電腦化','資料庫','認證課程','人才培訓'];
//主要選項
var cat_code_10100=['10101','10102','10103','10104','10105','10106','10107','10108'];
var cat_name_10100=['Windows','Linux','Unix','Windows2000','Windows NT','Solaris','FreeBSD','Mac OS'];
var cat_code_10200=['10201','10202','10203','10204'];
var cat_name_10200=['Internet基礎','中文輸入','硬體維修','兒童電腦'];
var cat_code_10300=['10301','10302','10303','10304','10305','10306','10309'];
var cat_name_10300=['Excel','Word','PowerPoint','Access','Outlook','Project','Office套裝課程'];
var cat_code_10400=['10401','10402','10403','10404','10405','10406','10407','10408','10409','10410','10429'];
var cat_name_10400=['網頁語法','DHTML','Front Page','Dreamweaver','Flash','Fusion','Java/VB Script','VB Script','XML','Fireworks','網頁設計養成'];
var cat_code_10500=['10501','10502','10503','10504','10505','10506','10507','10508','10509','10510','10511','10512','10514','10515','10516','10517','10529'];
var cat_name_10500=['AutoCad','Photoshop','Corel Draw','PhotoImpact','Maya','Primare','Aftereffect','Director','Lightwave','3D Studio','遊戲設計','Softimage','Painter','CakeWalk','PageMaker','Illustrator','多媒體養成班'];
var cat_code_10600=['10601','10602','10603','10604','10605','10606','10607','10608','10628','10629'];
var cat_name_10600=['ASP','Java','Visual Basic','Visual C++','LotusNotes','Delphi','Assembly','PDA程式設計','電子商務程式設計','程式設計養成'];
var cat_code_10700=['10701','10702','10703','10704','10705','10706','10729'];
var cat_name_10700=['NT','Exchange','TCP/IP','OpenVMS','Firewall','數位通信','網管工程師培訓'];
var cat_code_10900=['10901','10902','10903'];
var cat_name_10900=['電子商務','ERP','Intranet'];
var cat_code_11000=['11001','11002','11003','11004','11005','11006'];
var cat_name_11000=['SQL','VisualFaxpro','Oracle','DB2','Informix','MySQL'];
var cat_code_11100=['11101','11102','11103','11104','11105','11106','11129'];
var cat_name_11100=['TQC認證','ACE認證','Microsoft認證','Cisco認證','Novell認證','SUN認證','電腦師資培訓'];
var cat_code_11200=['11201'];
var cat_name_11200=['高科技人才培訓'];
var cat_code_20000=['20101','20102','20103','20104','20105','20201','20202','20203','20301','20401','20501','20601','20801','20901','21001','21101'];
var cat_name_20000=['英語基礎','英語會話','商用英語','英語特殊','兒童英語','日語基礎','日語中級','日語高階','法語','西班牙語','義大利語','德語','留學考試','語言師資培訓','其他外來語','中文'];
var cat_code_30000=['30101','30201','30301','30401','30501','30601','30701','30801','30901','31001','31101','31201','31301','31401','31501'];
var cat_name_30000=['企業經營','人力資源','行銷傳播','財務管理','金融投資','企業委訓','品質管理','生產管理','心靈成長','記憶學習','E化管理','國際貿易','企劃管理','知識管理','營建管理'];
//var cat_code_40000=['40101','40201','40301','40401','40501'];
//var cat_name_40000=['航空應試','飛行培訓','航空維修','航空講座','航空證照'];
var cat_code_50000=['50101','50201','50301','50401','50501','50601','50701','50801','50901','51001','52901'];
var cat_name_50000=['美國遊留學','加拿大遊留學','英國遊留學','紐西蘭遊留學','澳洲遊留學','日本遊留學','瑞士遊留學','德國遊留學','義大利遊留學','中國遊留學','國際文憑'];
var cat_code_60000=['60101','60201','60301','60401','60501'];
var cat_name_60000=['高普考試','專技考試','司法特考','研究所師資班','土地不動產'];
//推廣教育類別
var cat_code_70000=['70101','70201','70301','70401']; //,'70501'
var cat_name_70000=['北部大專院校','中部大專院校','南部大專院校','東部大專院校']; //,'外島'
var cat_code_0=['301','401','501','601','701','2901','901','1001','1101','1201','1301','1401','1501'];
var cat_name_0=['技能證照','進修學分班','高科技人才培訓','才藝技能','烹飪料理','其他','流通人才培訓','工業人才培訓','服裝設計','室內設計','美容美髮','命理五術','航空培訓'];
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More