⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emuldb.frm

📁 WinCE开发技巧与实例的配套源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmEmulDB 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "Convert TDB to CDB Format"
   ClientHeight    =   3750
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3585
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   ScaleHeight     =   3750
   ScaleWidth      =   3585
   Begin VBCE.TextBox Text2 
      Height          =   1095
      Left            =   120
      TabIndex        =   3
      Top             =   2040
      Width           =   3375
      _cx             =   5953
      _cy             =   1931
      BackColor       =   -2147483643
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Text            =   ""
      Alignment       =   0
      HideSelection   =   -1  'True
      Locked          =   0   'False
      MaxLength       =   0
      MultiLine       =   -1  'True
      PasswordChar    =   ""
      ScrollBars      =   0
   End
   Begin VBCE.TextBox Text1 
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   3375
      _cx             =   5953
      _cy             =   661
      BackColor       =   -2147483643
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Text            =   "\My Documents\biaoxian.tdb"
      Alignment       =   0
      HideSelection   =   -1  'True
      Locked          =   0   'False
      MaxLength       =   0
      MultiLine       =   0   'False
      PasswordChar    =   ""
      ScrollBars      =   0
   End
   Begin VBCE.CommandButton cmdCreateTables 
      Default         =   -1  'True
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   960
      Width           =   1335
      _cx             =   2143
      _cy             =   873
      BackColor       =   12632256
      Caption         =   "Create Tables..."
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Style           =   0
   End
   Begin VBCE.Label Label5 
      Height          =   375
      Left            =   120
      TabIndex        =   5
      Top             =   1560
      Width           =   3255
      _cx             =   5741
      _cy             =   661
      AutoSize        =   0   'False
      BackColor       =   -2147483643
      BackStyle       =   1
      BorderStyle     =   0
      Caption         =   "IMPORTANT! This will overwrite any existing tables with the same names"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Alignment       =   0
      UseMnemonic     =   -1  'True
      WordWrap        =   0   'False
   End
   Begin VBCE.Label Label4 
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   3360
      Width           =   3855
      _cx             =   2500
      _cy             =   500
      AutoSize        =   0   'False
      BackColor       =   -2147483643
      BackStyle       =   1
      BorderStyle     =   0
      Caption         =   "Errors while inserting the SQL strings"
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Alignment       =   0
      UseMnemonic     =   -1  'True
      WordWrap        =   0   'False
   End
   Begin VBCE.Label Label1 
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   3495
      _cx             =   6165
      _cy             =   450
      AutoSize        =   0   'False
      BackColor       =   -2147483643
      BackStyle       =   1
      BorderStyle     =   0
      Caption         =   "Type the path to the .TDB file you wish to convert."
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483640
      Alignment       =   0
      UseMnemonic     =   -1  'True
      WordWrap        =   0   'False
   End
End
Attribute VB_Name = "frmEmulDB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
'THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'PARTICULAR PURPOSE.

'Copyright  1998  Microsoft Corporation.  All Rights Reserved

Option Explicit


Sub CreateTable(Path)
    Dim rs
    Set rs = CreateObject("ADOCE.Recordset.3.0")
    rs.Open "CREATE DATABASE '\My Documents\testdb.cdb'"
    Dim WinCETDB, output
    Dim datastr As String
    Dim cn
    Set cn = CreateObject("ADOCE.Connection.3.0")
    Set WinCETDB = CreateObject("FILECTL.File")
    
    cn.Open "Provider=CEDB;Data Source=\My Documents\testdb.cdb;"
        On Error Resume Next
        
        WinCETDB.Open Path, 1  ' Opens the TDB file using the File Control
        
        If Err Then
            MsgBox "An Error has occured, [" & Err.Number & "] - [" & Err.Description & "]"
            Exit Sub
        End If
        
        On Error GoTo 0
        
        ' Loop through the file and pass the string to the Cn_Execute Sub
    
        Do While Not WinCETDB.EOF
            datastr = WinCETDB.LineInputString()
            If datastr = "End Of File" Then
                
                Exit Sub
            
            Else
                
                Call Cn_Execute(datastr, cn)
            
            End If
        
        Loop

End Sub

Sub Cn_Execute(SQLStr, cn)

On Error Resume Next
    cn.Execute SQLStr
    Text2 = Text2 + SQLStr
    If Err Then
        If Err.Number = "-2147217865" Or Err.Number = "-2147217908" Then ' Checking that blank line errors  AND drop table statements are ignored
            Err.Clear
        Else
            frmEmulDB.Text2.Text = frmEmulDB.Text2.Text & "Error -" & SQLStr & "'. Err - [" & Err.Number & "]- [" & Err.Description & "]" & vbCrLf ' Log the Error to the Text box on the Form
            Err.Clear
        End If
    End If
On Error GoTo 0

End Sub

Sub cmdCreateTables_Click()
    
    CreateTable (frmEmulDB.Text1.Text)

End Sub

Private Sub Label5_Click()

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -