摘要:
Option Explicit'--------------------------------------------------------'[Class name]: clsTxtFile'[Description]: Read Or Write Txt File'--------------------------------------------------------Private mFileNumber As IntegerPrivate mIsOpen As BooleanPrivate mEncoding As StringPrivate m 阅读全文
随笔分类 - VB
vba的一个DB操作类
2014-01-02 15:50 by xiashengwang, 1558 阅读, 收藏, 编辑
摘要:
Option Explicit'--------------------------------------------------------'[Class Name]: DBHelper'[Description]: databse access class'--------------------------------------------------------'variablePrivate mConn As ADODB.ConnectionPrivate mIsOpen As BooleanPrivate mIsBeginTran As 阅读全文
Excel数据批量导入到SqlServer的方法
2013-12-23 18:03 by xiashengwang, 10997 阅读, 收藏, 编辑
摘要:
1,以Excel为数据源建立连接导入。关键点在于Excel的数据要有表头,表头要和数据库表的列名一样。连接字符串中HDR=YES不能省略,也就是第一行是表头的意思。IMEX=1;是把数据都当作字符串读取。Sub test() Dim cn As ADODB.Connection Dim strSQL As String Dim lngRecsAff As Long Dim Headers As Boolean Dim strConn As String Dim path As String On Error GoTo test_Err... 阅读全文