提示内容是数据类型不被支持。是什么原因,我应该如何做?
下面是我用来连接数据库的连接语句,有没有什么问题?
ConnectString = "provider=MSDAORA.1;User ID=mis2;Password=mis;data source=mis2;Persist Security Info=False"
下面是我用来连接数据库的连接语句,有没有什么问题?
ConnectString = "provider=MSDAORA.1;User ID=mis2;Password=mis;data source=mis2;Persist Security Info=False"
'**************************************
' Name: ADO Upload and Retrieve ORACLE B
' LOB
' Description:To upload and retrieve ORA
' CLE BLOB File using ADO Recordset.
Never try with other than ORACLE database, but i think i can ...
' By: Herman Ibrahim
'
'
' Inputs:File Name
BLOB / LongRaw Field Name
ADO Blob RecordSet
'
' Returns:Boolean
'
'Assumes:I get this function somewhere f
' rom microsoft.com
Then the function is rewritten to make sure that it is easy to use and reuse...
'**************************************
Function AddLongRaw(ByVal strFileName As String, ByRef objRecSet As ADODB.Recordset, ByVal strFieldName As String) As Boolean
'How to call AddLongRaw function :
'dim bool as boolean
'dim objRecSet as new adodb.recordset
'dim strFieldeName as string
'strFieldName = objRecSet.Fields("YOUR_B
' LOB_FILE").Name
'bool = AddLongRaw(strSourceName, objRec
' Set, strFieldName)
'if bool then
'Successfully upload the BLOB file into
' database
'else
'Failed to upload the BLOB file into dat
' abase
'End If
AddLongRaw = False
Dim ByteData() As Byte 'Byte array for Blob data.
Dim SourceFile As Integer
Dim FileLength As Long
Dim Numblocks As Integer
Dim LeftOver As Long
Dim i As Integer
Const BlockSize = 10000 'This size can be experimented with for
SourceFile = FreeFile
Open strFileName For Binary Access Read As SourceFile
FileLength = LOF(SourceFile)' Get the length of the file.
'Debug.Print "Filelength is " & FileLeng
' th
If FileLength = 0 Then
Close SourceFile
AddLongRaw = False
Exit Function
Else
Numblocks = FileLength / BlockSize
LeftOver = FileLength Mod BlockSize
ReDim ByteData(LeftOver)
Get SourceFile, , ByteData()
objRecSet.Fields(strFieldName).AppendChunk ByteData()
ReDim ByteData(BlockSize)
For i = 1 To Numblocks
Get SourceFile, , ByteData()
objRecSet.Fields(strFieldName).AppendChunk ByteData()
Next i
AddLongRaw = True
Close SourceFile
End If
End Function
Function GetLongRaw(strFileName As String, objRecSet As ADODB.Recordset, strBLOBFieldName As String) As Boolean
GetLongRaw = False
Dim ByteData() As Byte 'Byte array for file.
Dim DestFileNum As Integer
Dim DiskFile As String
Dim FileLength As Long
Dim Numblocks As Integer
Const BlockSize = 10000
Dim LeftOver As Long
Dim i As Integer
FileLength = objRecSet.Fields(strBLOBFieldName).ActualSize
' Remove any existing destination file.
DiskFile = strFileName
If Len(Dir$(DiskFile)) > 0 Then
Kill DiskFile
End If
DestFileNum = FreeFile
Open DiskFile For Binary As DestFileNum
Numblocks = FileLength / BlockSize
LeftOver = FileLength Mod BlockSize
ByteData() = objRecSet.Fields(strBLOBFieldName).GetChunk(LeftOver)
Put DestFileNum, , ByteData()
For i = 1 To Numblocks
ByteData() = objRecSet.Fields(strBLOBFieldName).GetChunk(BlockSize)
Put DestFileNum, , ByteData()
Next i
Close DestFileNum
GetLongRaw = True
'============
'The object file is now located at strFi
' leName
'============
End Function
我机器上面的oracle连接字符串:
Provider=OraOLEDB.Oracle.1;Password=a;Persist Security Info=True;User ID=mysystem;Data Source=FZSYSTEM