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

📄 emuldb.ebf

📁 《Windows CE 权威指南》(作者:(美)CHRIS MUENCH
💻 EBF
字号:
VERSION 5.00
Begin VB.Form frmEmulDB 
   Caption         =   "Convert TDB to Windows CE Tables"
   ClientHeight    =   2820
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6990
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ScaleHeight     =   2820
   ScaleWidth      =   6990
   Begin VB.TextBox Text2 
      Height          =   1095
      Left            =   120
      MultiLine       =   -1  'True
      TabIndex        =   4
      Top             =   1680
      Width           =   6735
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   360
      Width           =   4815
   End
   Begin VB.CommandButton cmdCreateTables 
      Caption         =   "Create Tables..."
      Default         =   -1  'True
      Height          =   375
      Left            =   5040
      TabIndex        =   0
      Top             =   360
      Width           =   1815
   End
   Begin VB.Label Label5 
      Caption         =   "IMPORTANT! This will overwrite any existing tables with the same names"
      Height          =   255
      Left            =   1560
      TabIndex        =   7
      Top             =   840
      Width           =   5295
   End
   Begin VB.Label Label4 
      Caption         =   "Errors while inserting the SQL strings"
      Height          =   255
      Left            =   120
      TabIndex        =   6
      Top             =   1320
      Width           =   3855
   End
   Begin VB.Label Label3 
      Caption         =   "Running String"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   5
      Top             =   840
      Width           =   1455
   End
   Begin VB.Label Label2 
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   1080
      Width           =   6735
   End
   Begin VB.Label Label1 
      Caption         =   "Type the path to the .TDB file of the DB you want to create."
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   4455
   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 WinCETDB
 
 ' <BOOK_ADDON Chapter 8.5.1> ************************************
    Dim rs
    Set rs = CreateObject("ADOCE.Recordset")
    rs.Open "CREATE DATABASE '\My Documents\DeluxeCD.cdb'"
 ' </BOOK_ADDON Chapter 8.5.1> ************************************
   
    Set WinCETDB = CreateObject("FILECTL.File")
    
        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 Rs_Open Sub
    
        Do While Not WinCETDB.EOF
            
            If WinCETDB.LineInputString() = "End Of File" Then
                
                Exit Sub
            
            Else
                
                Call Rs_Open(WinCETDB.LineInputString())
            
            End If
        
        Loop

End Sub

Sub Rs_Open(SQLStr)
Dim rs
Set rs = CreateObject("ADOCE.Recordset")


frmEmulDB.Label2.Caption = SQLStr

On Error Resume Next

    
' <BOOK_ADDON Chapter 8.5.1> ************************************
      rs.Open SQLStr, "\My Documents\DeluxeCD.CDB", 2, 3
     'rs.Open SQLStr, , 2, 3
' <BOOK_ADDON Chapter 8.5.1> ************************************
     
    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 + -