清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
While dbrRows.Read
strInsert = "INSERT INTO `" & conData.Database & "`.`" & Table & "` ("
Dim intFieldCount As Integer = dbrRows.FieldCount - 1
Dim columns As New List(Of String)
Dim values As New List(Of String)
For intColumns As Integer = 0 To intFieldCount
If Not IsDBNull(dbrRows(intColumns)) Then
columns.Add("`" & dbrRows.GetName(intColumns) & "`")
Dim strType As String = dbrRows.Item(intColumns).GetType.ToString
Select Case strType
Case "System.DateTime" l
Dim dteValue As DateTime = dbrRows.GetMySqlDateTime(intColumns)
Dim strValue As String = "'" & dteValue.Year & "-" & _
dteValue.Month & "-" & _
dteValue.Day & "'"
values.Add(strValue)
Case "System.Boolean"
Dim intBoolean As Integer
If dbrRows.Item(intColumns) = True Then
intBoolean = 1
Else
intBoolean = 0
End If
values.Add(intBoolean.ToString)
Case "System.String"
Dim strValue As String = dbrRows.GetString(intColumns)
strValue = strValue.Replace("'", "''")
strValue = strValue.Replace(";", "")
values.Add("'" & strValue & "'")
Case "System.Byte[]"
Dim bytBlob(1048576) As Byte
Dim lngFileLength As Long = _
dbrRows.GetBytes(intColumns, 0, bytBlob, 0, 1048576)
ReDim Preserve bytBlob(lngFileLength)
values.Add("0x" & ByteArrayToHex(bytBlob))
Case Else 'Otherwise
If IsNumeric(dbrRows.Item(intColumns)) Then
values.Add(dbrRows.Item(intColumns))
Else
values.Add("'" & dbrRows.Item(intColumns).ToString & "'")
End If
End Select
End If
Next
strInsert &= Join(columns.ToArray, ", ") & ") " & "VALUES ( "
strInsert &= Join(values.ToArray, ", ") & " )"