tutorials.de Buch-Aktion 05/2012
ERLEDIGT
JA
ANTWORTEN
2
ZUGRIFFE
1282
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    tombo82 tombo82 ist offline Mitglied Silber
    Registriert seit
    Jul 2007
    Beiträge
    80
    Hallo, ich will eine MySQL DB auslesen, und die Daten in eine Dbase-Tabelle schreiben:

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    
    Dim start As String = DateTime.Now
            If File.Exists(pfad & "\I001\ITDOWNL\copydat.dbf") = True Then
             ....
            Else
                copytemp.Reset()
                sendmysqlstatement("select * from copytemp where status='0'", db)
                If copytemp.Rows.Count = 0 Then
                    MessageBox.Show("Keine Bestellungen gefunden")
                Else
                    Dim anz As String = copytemp.Rows.Count.ToString
                    File.Copy(Application.StartupPath & "\copydat.dbf", pfad & "\I001\ITDOWNL\copydat.dbf")
                    For i As Integer = 0 To copytemp.Rows.Count - 1
                        BackgroundWorker1.ReportProgress(i + 1)
                        copydatdbf("insert into copydat (spnrv,genrv,datum,wmznr,alanz,anzahl,kuenrv,kdnrv,tournr,astnr,bontext,vgeb,subhoehe,schl,preis,bearb,bdatum,bzeit,mwsatz,essenpos,kdnr,neubest,viele,enr) values ('" & copytemp.Rows(i).Item(0) & "','" & copytemp.Rows(i).Item(1) & "','" & copytemp.Rows(i).Item(2) & "','" & copytemp.Rows(i).Item(3) & "','" & copytemp.Rows(i).Item(4) & "','" & copytemp.Rows(i).Item(5) & "','" & copytemp.Rows(i).Item(6) & "','" & copytemp.Rows(i).Item(7) & "','" & copytemp.Rows(i).Item(8) & "','" & copytemp.Rows(i).Item(9) & "','" & copytemp.Rows(i).Item(10) & "','" & copytemp.Rows(i).Item(11) & "','" & copytemp.Rows(i).Item(12) & "','" & copytemp.Rows(i).Item(13) & "','" & copytemp.Rows(i).Item(14) & "','" & copytemp.Rows(i).Item(15) & "','" & copytemp.Rows(i).Item(16) & "','" & copytemp.Rows(i).Item(17) & "','" & copytemp.Rows(i).Item(18) & "','" & copytemp.Rows(i).Item(19) & "','" & copytemp.Rows(i).Item(20) & "',0,0,'" & copytemp.Rows(i).Item(23) & "')", pfad & "\I001\ITDOWNL")
                        Dim datum As String = copytemp.Rows(i).Item(2).ToString.Substring(6, 4) & "-" & copytemp.Rows(i).Item(2).ToString.Substring(3, 2) & "-" & copytemp.Rows(i).Item(2).ToString.Substring(0, 2)
                        sendmysqlstatement("update copytemp set status='1' where kdnrv=" & copytemp.Rows(i).Item(7) & " and genrv='" & copytemp.Rows(i).Item(1) & "' and datum='" & datum & "'", db)
                    Next
                    Dim ende As String = DateTime.Now
                    copytemp.Reset()
                    MessageBox.Show("fertig, " & anz & " wurden geholt!" & Chr(13) & "Benötigte Zeit: " & start & Chr(13) & ende)
                End If
            End If

    das klappt bis zum 100. von 294 Datensätzen,
    dann bekomme ich nen Fehler: TargetInvocationException wurde nicht behandelt

    er fliegt dann bei dat.fill(copydat) raus und wirft dann die Fehlermeldung unten

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    Private Sub copydatdbf(ByVal selectCommand As String, ByVal pfad As String)
            Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & pfad & "';Extended Properties=dBASE IV;User ID=;Password=;")
            Dim dat As New OleDbDataAdapter(selectCommand, con)
            If con.State = ConnectionState.Closed Then
                con.Open()
            End If
            [B][U]dat.Fill(copydat)[/U][/B]
            con.Close()
        End Sub



    Hier die komplette Fehlermeldung:
    System.Reflection.TargetInvocationException wurde nicht behandelt.
    Message="Ein Aufrufziel hat einen Ausnahmefehler verursacht."
    Source="mscorlib"
    StackTrace:
    bei System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    bei System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
    bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    bei System.Delegate.DynamicInvokeImpl(Object[] args)
    bei System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
    bei System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
    bei System.Threading.ExecutionContext.runTryCode(Object userData)
    bei System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
    bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    bei System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
    bei System.Windows.Forms.Control.InvokeMarshaledCallbacks()
    bei System.Windows.Forms.Control.WndProc(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.Run(ApplicationContext context)
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    bei copydat_krücke_13.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
    bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
    bei System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
    bei System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
    bei System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
    bei System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
    bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
    bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    bei System.Threading.ThreadHelper.ThreadStart()

    Was bedeutet der Fehler und wie komme ich an alle 294 Datensätze?

    Danke schonma, Tommi
     

  2. #2
    Avatar von Nico Graichen
    Nico Graichen Nico Graichen ist offline aka gemballa
    tutorials.de Moderator
    Registriert seit
    Dec 2003
    Ort
    Pulheim (NRW)
    Beiträge
    3.898
    Blog-Einträge
    34
    Hi

    Gibt es eine InnerException und wenn ja, mit welchem Inhalt
     
    Grüße Nico
    ----------------------
    Xing
    ----------------------
    Zitat Zitat von Mark Twain (1835-1910)
    Es gibt drei Dinge, die eine Frau aus dem Nichts hervorzaubern kann: einen Hut, einen Salat und einen Ehekrach.
    Zitat Zitat von Mike Wilson - Biographie über Larry Ellison (CEO Oracle)
    The Difference Between God and Larry Ellison: God Doesn't Think He's Larry Ellison

  3. #3
    tombo82 tombo82 ist offline Mitglied Silber
    Registriert seit
    Jul 2007
    Beiträge
    80
    Code :
    1
    
    "   bei System.Windows.Forms.ProgressBar.set_Value(Int32 value)\r\n   bei copydat_krücke_13.Form1.BackgroundWorker2_ProgressChanged(Object sender, ProgressChangedEventArgs e) in C:\\Dokumente und Einstellungen\\eggert\\Eigene Dateien\\Visual Studio 2005\\Projects\\copydat krücke 13\\copydat krücke 13\\Form1.vb:Zeile 591.\r\n   bei System.ComponentModel.ProgressChangedEventHandler.Invoke(Object sender, ProgressChangedEventArgs e)\r\n   bei System.ComponentModel.BackgroundWorker.OnProgressChanged(ProgressChangedEventArgs e)\r\n   bei System.ComponentModel.BackgroundWorker.ProgressReporter(Object arg)"

    PS: Fehler gefunde, lag an der Progessbar...
    Warum auch immer..