Click here to Skip to main content
16,018,938 members

Comments by 1DSparrows (Top 22 by date)

1DSparrows 13-Mar-18 21:08pm View    
Here how I used your code:

If (dt.Rows.Count > 100000) Then

Dim scr As DataTable = New DataTable()
scr.Columns.Add(New DataColumn("key_id", Type.GetType("System.Int32")))

For _c As Integer = 0 To dt.Rows.Count
scr.Rows.Add(New Object() {_c})
Next

Dim increasement As Integer = 30000
Dim curVal As Integer = 1
Dim result As DataRow()
Dim ds As DataSet = New DataSet()
Do
result = scr.Select(String.Format("key_id >={0} And key_id<{1}", curVal, curVal + increasement)).Clone()
If result.Length > 0 Then
Dim tmp As DataTable = scr.Clone()
Dim sb As StringBuilder = New StringBuilder()
For Each dr As DataRow In result
tmp.Rows.Add(New Object() {dr("key_id")})
sb.Append(String.Format("{0};", dr("key_id")))
Next
ds.Tables.Add(tmp)
Console.WriteLine("{0}", sb.ToString())
sb = Nothing
End If
curVal += increasement
Loop While (result.Length > 0)


End If

dt.WriteXml(writer, False)
1DSparrows 13-Mar-18 19:29pm View    
The code was correct but the problem is the looping just continue and nothing happened. I don't even got successfully uploaded the data into my database. Thus, console.readkey() is for console app? I'm doing web application in ASP.NET application (like one running in IIS).

I tried to upload 50 records to check then I put 10 on the increasement but then 39 records only was uploaded.
1DSparrows 13-Mar-18 4:43am View    
Hi I still get the out of memory error when I upload 130,000 records.
1DSparrows 13-Mar-18 4:18am View    
Deleted
okay, I'm trying your code now. I already uploaded the data and it is 130,000. I'm waiting for the result. It will just take time because of the looping right?
1DSparrows 13-Mar-18 3:58am View    
is increasement As Integer = 30 always, or I can change it base on the range I need that the table can have? so if I put 30000, the table will have each 30000?