samedi 27 juin 2015

Sync Data Between android app and vb.net app

I guys ,I have a very critical problem in my code . I am not getting is that my logical problem or something else.In all the ways code looks perfect ,even it works perfect for limited data.There is code

Database.connect()
        Database.connectSqlite()
        Dim dt As New DataTable
        Dim sqladap As New OleDb.OleDbDataAdapter
        Dim sqlitecommm As New SQLite.SQLiteCommand
        With sqlcomm
            '.Transaction = mytran
            .CommandText = "select * from DCMaster"
            .Connection = myconnection
        End With

        sqladap = New OleDb.OleDbDataAdapter(sqlcomm)
        sqladap.Fill(dt)
        'MsgBox("Started Job 1")
        Label4.Text = "(0" + "/" + dt.Rows.Count.ToString + ")"

        ProgressBar1.Maximum = dt.Rows.Count

        'sqlitecommm.Transaction = sqlitetransaction
        sqlitecommm.Connection = sqliteconnecttion
        For i = 0 To dt.Rows.Count - 1
            sqlitecommm.CommandText = Nothing
            sqlitecommm.CommandText = "insert into DCMaster (DCNo,DCDate,PName,PAdd,PPhone,DriverName,VehicleNo,TotalQty,TotalSqft,TotalAmt,Freight,NetAmt) values (" & dt.Rows(i)("DCNo") & ",'" & Date.Parse(dt.Rows(i)("DCDate")).ToString("yyyy-MM-dd") & "','" & dt.Rows(i)("PName") & "','" & dt.Rows(i)("PAdd") & "','" & dt.Rows(i)("PPhone") & "','" & dt.Rows(i)("DriverName") & "','" & dt.Rows(i)("VehicleNo") & "','" & dt.Rows(i)("TotalQty") & "','" & dt.Rows(i)("TotalSqft") & "','" & dt.Rows(i)("TotalAmt") & "','" & dt.Rows(i)("Freight") & "','" & dt.Rows(i)("NetAmt") & "')"
            'sqlitecommm.Transaction = sqlitetransaction
            sqlitecommm.ExecuteNonQuery()
            Label4.Text = "(" + (i + 1).ToString + "/" + dt.Rows.Count.ToString + ")"
            ProgressBar1.Value = i
            'Thread.Sleep(50)
        Next
        dt.Reset()
        dt.Dispose()
        GC.Collect()

Now , guys my problem is I have four tables in sqlite database in which I need to transfer data from desktop application .Even file of sqlite database is on desktop in same application directory.But at time of transfer few records from one table automatically goes to another table but not all in sqlite.I am not getting what is exact problem. Please help me to get out of these. Please.... Thanks in advance.Sorry for long question.....

Aucun commentaire:

Enregistrer un commentaire