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

📄 form1.frm

📁 该源码给出了一个插入大数据量(超过4000条记录)的示范例子。一般而言
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7920
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10575
   LinkTopic       =   "Form1"
   ScaleHeight     =   7920
   ScaleWidth      =   10575
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdinsertdata 
      Caption         =   "Insert Data"
      Height          =   495
      Left            =   7920
      TabIndex        =   6
      Top             =   840
      Width           =   1095
   End
   Begin VB.TextBox txtResume 
      Height          =   5175
      Left            =   840
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   2
      Top             =   2400
      Width           =   8775
   End
   Begin VB.TextBox txtName 
      Height          =   495
      Left            =   1080
      TabIndex        =   1
      Top             =   1320
      Width           =   2655
   End
   Begin VB.TextBox txtID 
      Height          =   375
      Left            =   1080
      TabIndex        =   0
      Top             =   360
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "Resume"
      Height          =   375
      Left            =   960
      TabIndex        =   5
      Top             =   2040
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "Name"
      Height          =   255
      Left            =   1080
      TabIndex        =   4
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "ID"
      Height          =   255
      Left            =   1080
      TabIndex        =   3
      Top             =   120
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************************************************
' MODULE:  run the oracle procedure and populate the long column
' COPYRIGHT:    Copyright 2001 Jay polam. All Rights Reserved.
'
' DESCRIPTION:
'This application will insert the data into long column, if you can use sqlplus you can insert the
'up to 4000 charcters, if you write a procedure, you can insert upto 32000 characters using vb application with
'ADO calling stored procedure.
' This is 'free' software with the following restrictions:
'
' You may not redistribute this code as a 'sample' or 'demo'. However, you are free
' to use the source code in your own code, but you may not claim that you created
' the sample code. It is expressly forbidden to sell or profit from this source code
' other than by the knowledge gained or the enhanced value added by your own code.
'
' Use of this software is also done so at your own risk. The code is supplied as
' is without warranty or guarantee of any kind.
'
' Should you wish to commission some derivative work based on this code provided
' here, or any consultancy work, please do not hesitate to contact me.
'

' E-mail:   jaypolam@hotmail.com

'*******************************************************************************
Private Sub cmdinsertdata_Click()
    On Error GoTo InserTERROR
    Dim cn As ADODB.Connection
    Dim RSCOM As ADODB.Command
    Dim strcon As String
   
    Dim QID As Long
    Dim QNAME As String
    Dim QRESUME As String
    
    If txtID.Text = "" Then
        MsgBox "Please enter the ID"
        txtID.SetFocus
        Exit Sub
    End If
    If txtName.Text = "" Then
        MsgBox "Please enter the Name"
        txtName.SetFocus
        Exit Sub
    End If
    If txtResume.Text = "" Then
        MsgBox "Please enter the resume Text"
        txtResume.SetFocus
        Exit Sub
    End If
    QID = Val(txtID.Text)
    QNAME = txtName.Text
    QRESUME = txtResume.Text
    
    Set cn = New ADODB.Connection
   
    Set RSCOM = New ADODB.Command
    
    strcon = "provider=msdasql;dsn=yourDSN name;uid=youruserid;pwd=yourpassword;"
    
    With cn
        .ConnectionString = strcon
        .CursorLocation = adUseClient
        .Open
    End With
   
   
    With RSCOM
        .ActiveConnection = cn
        .CommandText = "INSERTTOTEST"
        .CommandType = adCmdStoredProc
        .Parameters.Append .CreateParameter(, adInteger, adParamInput)
        .Parameters.Append .CreateParameter(, adVarChar, adParamInput, 50)
        .Parameters.Append .CreateParameter(, adVarChar, adParamInput, 31474)
    End With

    RSCOM(0) = QID
    RSCOM(1) = QNAME
    RSCOM(2) = QRESUME
    RSCOM.Execute
    Set RSCOM = Nothing
    cn.Close
    Set cn = Nothing
    Exit Sub
InserTERROR:
    MsgBox Err.Number & vbCrLf & Err.Description
    
    If cn.State = adStateOpen Then
        Set RSCOM = Nothing
        cn.Close
        Set cn = Nothing
    End If
    
    Exit Sub
End Sub

⌨️ 快捷键说明

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