0
Public Sub uploadVehicle_Transaction()
Try
Dim VT As New DataTable
VT = New Statn_Sync.DataSetTableAdapters.Vehicle_TransactionsTableAdapter().GetData()
For Each dr As DataRow In VT.Rows
Dim MOV As String = comT.insertVehicle_Transaction(Convert.ToUInt64(dr("TransactionID")), _
Convert.ToDateTime(dr("Transaction_date")), _
Convert.ToUInt32(dr("Bank")), _
Convert.ToString(dr("Teller_number")), _
Convert.ToUInt32(dr("Amount")), _
Convert.ToString(dr("Generated_by")), _
Convert.ToString(dr("Station")), _
Convert.ToString(dr("Customer_name")), _
Convert.ToUInt32(dr("Transaction_category")), _
Convert.ToString(dr("Deposit_slip")), _
Convert.ToUInt32(dr("Sync")), _
Convert.ToDecimal(dr("Penalty")), _
Convert.ToDecimal(dr("OGSG")), _
Convert.ToDecimal(dr("CMR")), _
Convert.ToDecimal(dr("Goshen")), _
Convert.ToDecimal(dr("Insurance")), _
Convert.ToDecimal(dr("OCost")), _
Convert.ToDecimal(dr("OGSG_Renewal")), _
Convert.ToDecimal(dr("De_pulse")))
AddToLog(Convert.ToString(dr("paytAdEntryID").ToString))
Next
Catch ex As Exception
AddToLog(ex.Message)
End Try
End Sub
TRANSACTIONID BIGINT未選中, TRANSACTION_DATE日期時間未選中, 銀行INT經過,teller_number VARCHAR(20)未選中, 量INT未選中,generated_by爲nvarchar(50)未檢查 站VARCHAR(20)經過,CUSTOMER_NAME VARCHAR(50)經過 transaction_category INT未經檢查的,deposit_slip VARCHAR(20)經過 同步INT未經檢查的, 罰金十進制(18,2)經過 OGSG十進制(18,2)經過 CMR小數(18,2)檢查 戈十進制(18,2)經過 保險十進制(18,2)經過 OCost十進制(18,2)經過 OGSG_Renewal十進制(18,2)經過 De_pulse十進制(18,2)經過 – olaseun28
@Brain麥凱那我的MSSQLtable結構分別是什麼你認爲我應該做的? – olaseun28
@ olaseun28表結構實際上是一個完整的其他對話,還有其他考慮因素。這裏的問題是VT.Rows有一些空值的行。空值是好的,但您需要檢查System.DbNull並在轉換之前處理空值。如果你只是在這裏進行轉換,最終你會遇到null,並且會拋出異常。 –