By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,086 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,086 IT Pros & Developers. It's quick & easy.

Speed in VB 2005

P: n/a
I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the
data grid in vb 2005 it takes aroudn 20 seconds. IS there something that
could be causing this problem?
Aug 7 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Stephen,
>IS there something that could be causing this problem?
Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.com ...
>I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the
data grid in vb 2005 it takes aroudn 20 seconds. IS there something that
could be causing this problem?

Aug 7 '06 #2

P: n/a
Hello Cor Ligthert [MVP],

*pokes* Cor, There was no VB6 mentioned. I know 2003 was a long time ago..

-Boo
Stephen,
>IS there something that could be causing this problem?
Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)

Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.com ...
>I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a
data adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to
load the data grid in vb 2005 it takes aroudn 20 seconds. IS there
something that could be causing this problem?

Aug 7 '06 #3

P: n/a
"GhostInAK" <gh*******@gmail.comwrote in message
news:be**************************@news.microsoft.c om...
Hello Cor Ligthert [MVP],

*pokes* Cor, There was no VB6 mentioned. I know 2003 was a long time
ago..

-Boo
fwiw, I'd like to see any dotNet code run faster than a fully compiled and
optimized VB6 version of that same code. Heck... I'd like to see a dotNet
IDE that starts up in less time than it takes to make a cup of coffee. Oh
well... Quad core CPUs are coming out soon. Maybe then we'll see 386 era
performance from a dotNet app.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
Aug 7 '06 #4

P: n/a
Hi,

Boo, you are right, I don't know where I got that VB6..

Cor

"GhostInAK" <gh*******@gmail.comschreef in bericht
news:be**************************@news.microsoft.c om...
Hello Cor Ligthert [MVP],

*pokes* Cor, There was no VB6 mentioned. I know 2003 was a long time
ago..

-Boo
>Stephen,
>>IS there something that could be causing this problem?
Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)

Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.co m...
>>I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a
data adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to
load the data grid in vb 2005 it takes aroudn 20 seconds. IS there
something that could be causing this problem?


Aug 7 '06 #5

P: n/a
Stephen,

Sorry for my misunderstanding.
Are you using exactly the same code, because this is the first time I read
about your problem.

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
Stephen,
>>IS there something that could be causing this problem?

Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.com ...
>>I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the
data grid in vb 2005 it takes aroudn 20 seconds. IS there something that
could be causing this problem?


Aug 7 '06 #6

P: n/a
All I did was install the VB 2005 and copy the source ccode from the VB.NET
(2003)

Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String

If Mid(UserNoLink, 1, 1) = "0" Or Mid(UserNoLink, 1, 1) = "9" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

End If

If Mid(UserNoLink, 1, 1) = "1" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE BDRNo LIKE '" &
Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "2" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE RDSNo LIKE '" &
Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "3" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE MSNo LIKE '" &
Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "4" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE SDSNo LIKE '" &
Mid(UserNoLink, 1, 4) & "'"

End If

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

Fil_Name()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Steve

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ub**************@TK2MSFTNGP02.phx.gbl...
Stephen,

Sorry for my misunderstanding.
Are you using exactly the same code, because this is the first time I read
about your problem.

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
>Stephen,
>>>IS there something that could be causing this problem?

Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.co m...
>>>I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the
data grid in vb 2005 it takes aroudn 20 seconds. IS there something that
could be causing this problem?



Aug 7 '06 #7

P: n/a
Stephen,

I don't know why it is,

I made this Test program
\\\
'Set in advance a reference to COM adox ext 2.x for dll and security

Public Class Main
Public Shared Sub Main()
'cleanup old databases
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c:\db1.mdb")
If fi.Exists Then
If MessageBox.Show("Delete?", "Existing File db1.mdb", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=C:\db1.mdb")

Dim conn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;" & _
" Data Source=C:\db1.mdb;User Id=admin;Password=;")
Dim cmd As New OleDb.OleDbCommand("CREATE TABLE tester ( " & _
"Id int ," & _
"Whatever NVarchar(50)," & _
"CONSTRAINT [pk_Id] PRIMARY KEY (Id)) ", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter("Select * from tester", conn)
da.Fill(ds)
For i As Integer = 0 To 40000
ds.Tables(0).LoadDataRow(New Object() {i, i.ToString}, False)
Next
Dim cmb As New OleDb.OleDbCommandBuilder(da)
da.Update(ds)
Dim ds2 As New DataSet
Dim start As Integer = Environment.TickCount
da.Fill(ds2)
MessageBox.Show((Environment.TickCount - start).ToString)
End Sub
End Class
///

The result is that the Fill part is about 7 times slower in VB2005 than in
VB2003

I will put this problem as well in another place.

It does not help you but you know that I had the same result.

Cor
"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:rJ******************************@giganews.com ...
All I did was install the VB 2005 and copy the source ccode from the
VB.NET (2003)

Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String

If Mid(UserNoLink, 1, 1) = "0" Or Mid(UserNoLink, 1, 1) = "9" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

End If

If Mid(UserNoLink, 1, 1) = "1" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE BDRNo LIKE '"
& Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "2" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE RDSNo LIKE '"
& Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "3" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE MSNo LIKE '"
& Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "4" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE SDSNo LIKE '"
& Mid(UserNoLink, 1, 4) & "'"

End If

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

Fil_Name()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Steve

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ub**************@TK2MSFTNGP02.phx.gbl...
>Stephen,

Sorry for my misunderstanding.
Are you using exactly the same code, because this is the first time I
read about your problem.

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
>>Stephen,

IS there something that could be causing this problem?

Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews.c om...
I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load
the data grid in vb 2005 it takes aroudn 20 seconds. IS there something
that could be causing this problem?



Aug 8 '06 #8

P: n/a
Cor,

Thanks for the quick program and test. I'll need to go back to using vb.NET
for now until this can get resolved; what are the procedures for finding out
when this gets fixed?

Steve
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O5**************@TK2MSFTNGP06.phx.gbl...
Stephen,

I don't know why it is,

I made this Test program
\\\
'Set in advance a reference to COM adox ext 2.x for dll and security

Public Class Main
Public Shared Sub Main()
'cleanup old databases
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c:\db1.mdb")
If fi.Exists Then
If MessageBox.Show("Delete?", "Existing File db1.mdb", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=C:\db1.mdb")

Dim conn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;" & _
" Data Source=C:\db1.mdb;User Id=admin;Password=;")
Dim cmd As New OleDb.OleDbCommand("CREATE TABLE tester ( " & _
"Id int ," & _
"Whatever NVarchar(50)," & _
"CONSTRAINT [pk_Id] PRIMARY KEY (Id)) ", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter("Select * from tester", conn)
da.Fill(ds)
For i As Integer = 0 To 40000
ds.Tables(0).LoadDataRow(New Object() {i, i.ToString}, False)
Next
Dim cmb As New OleDb.OleDbCommandBuilder(da)
da.Update(ds)
Dim ds2 As New DataSet
Dim start As Integer = Environment.TickCount
da.Fill(ds2)
MessageBox.Show((Environment.TickCount - start).ToString)
End Sub
End Class
///

The result is that the Fill part is about 7 times slower in VB2005 than in
VB2003

I will put this problem as well in another place.

It does not help you but you know that I had the same result.

Cor
"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:rJ******************************@giganews.com ...
>All I did was install the VB 2005 and copy the source ccode from the
VB.NET (2003)

Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micro soft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String

If Mid(UserNoLink, 1, 1) = "0" Or Mid(UserNoLink, 1, 1) = "9" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

End If

If Mid(UserNoLink, 1, 1) = "1" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE BDRNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "2" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE RDSNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "3" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE MSNo LIKE '"
& Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "4" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE SDSNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

Fil_Name()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Steve

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ub**************@TK2MSFTNGP02.phx.gbl...
>>Stephen,

Sorry for my misunderstanding.
Are you using exactly the same code, because this is the first time I
read about your problem.

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
Stephen,

>IS there something that could be causing this problem?

Yes a lot, but in most cases (not all) VBNet is faster.

Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews. com...
>I upgraded from VB 2003 to VB 2005.
>
I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load
the data grid in vb 2005 it takes aroudn 20 seconds. IS there
something that could be causing this problem?
>




Aug 8 '06 #9

P: n/a
On Mon, 7 Aug 2006 14:55:17 -0500, "Stephen Plotnick" <sp*******@groupcbf.comwrote:

I upgraded from VB 2003 to VB 2005.

I have a 4000 record table in Access that I'm using oleDB to do a data
adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to load the
data grid in vb 2005 it takes aroudn 20 seconds. IS there something that
could be causing this problem?


Aren't you using some type of paging mechanism for the DataGrid. Querying for and loading 4,000 rows
at one time is really not a very good idea.
Paul
~~~~
Microsoft MVP (Visual Basic)
Aug 8 '06 #10

P: n/a
Stephen,

I don't know if the method with the datareader will help you.

http://msdn2.microsoft.com/en-us/lib...able.load.aspx

I did not test that.

Cor

"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:X8******************************@giganews.com ...
Cor,

Thanks for the quick program and test. I'll need to go back to using
vb.NET for now until this can get resolved; what are the procedures for
finding out when this gets fixed?

Steve
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O5**************@TK2MSFTNGP06.phx.gbl...
>Stephen,

I don't know why it is,

I made this Test program
\\\
'Set in advance a reference to COM adox ext 2.x for dll and security

Public Class Main
Public Shared Sub Main()
'cleanup old databases
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c:\db1.mdb")
If fi.Exists Then
If MessageBox.Show("Delete?", "Existing File db1.mdb", _
MessageBoxButtons.YesNo) = DialogResult.Yes Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0; " & "Data
Source=C:\db1.mdb")

Dim conn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLE DB.4.0;" & _
" Data Source=C:\db1.mdb;User Id=admin;Password=;")
Dim cmd As New OleDb.OleDbCommand("CREATE TABLE tester ( " & _
"Id int ," & _
"Whatever NVarchar(50)," & _
"CONSTRAINT [pk_Id] PRIMARY KEY (Id)) ", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter("Select * from tester", conn)
da.Fill(ds)
For i As Integer = 0 To 40000
ds.Tables(0).LoadDataRow(New Object() {i, i.ToString}, False)
Next
Dim cmb As New OleDb.OleDbCommandBuilder(da)
da.Update(ds)
Dim ds2 As New DataSet
Dim start As Integer = Environment.TickCount
da.Fill(ds2)
MessageBox.Show((Environment.TickCount - start).ToString)
End Sub
End Class
///

The result is that the Fill part is about 7 times slower in VB2005 than
in VB2003

I will put this problem as well in another place.

It does not help you but you know that I had the same result.

Cor
"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:rJ******************************@giganews.co m...
>>All I did was install the VB 2005 and copy the source ccode from the
VB.NET (2003)

Private Sub PopulateStoreGrid()

Dim conn As New
System.Data.OleDb.OleDbConnection("Provider=Micr osoft.Jet.OLEDB.4.0;Data
source=C:\BMActivityReporting.mdb;Persist Security Info=False")

Dim sSQL As String

If Mid(UserNoLink, 1, 1) = "0" Or Mid(UserNoLink, 1, 1) = "9" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE"

End If

If Mid(UserNoLink, 1, 1) = "1" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE BDRNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "2" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE RDSNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "3" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE MSNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

If Mid(UserNoLink, 1, 1) = "4" Then

sSQL = "select BM_NUMBER, STORE_NUMBER, STORE, SHIP_ADDRESS1 as ADDRESS,
SHIP_CITY as CITY, SHIP_ST as STATE from BENMOORETABLE WHERE SDSNo LIKE
'" & Mid(UserNoLink, 1, 4) & "'"

End If

Dim sSQL2 As String = "select * from BENMOORETABLE"

conn.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter(sSQL, conn)

Dim da2 As New System.Data.OleDb.OleDbDataAdapter(sSQL2, conn)

Try

da.Fill(myDS, "BENMOOR1")

iCount = myDS.Tables("BENMOOR1").Rows.Count

da2.Fill(myDS, "BENMOOR2")

myDV = myDS.Tables("BENMOOR2").DefaultView

DataGrid1.DataSource = myDS

DataGrid1.DataMember = "BENMOOR1"

Dim irow As Integer

Dim icol As Integer

irow = 0

DataGrid1.Select(irow)

Dim sStore As String = CType(DataGrid1.Item(irow, 1), String)

myDV.Sort = "STORE_NUMBER"

Dim rowIndex As Integer = myDV.Find(sStore)

Me.LegalName1.Text = myDV(rowIndex)("LEGAL_NAME_LINE1").ToString()

Me.LegalName2.Text = myDV(rowIndex)("LEGAL_NAME_LINE2").ToString()

Me.StoreOwner.Text = myDV(rowIndex)("STORE_OWNER").ToString()

Me.PhoneNumber.Text = myDV(rowIndex)("PHONE_NUMBER").ToString()

Me.LegalName3.Text = myDV(rowIndex)("LEGAL_NAME_LINE3").ToString()

Me.LegalName4.Text = myDV(rowIndex)("LEGAL_NAME_LINE4").ToString()

Me.EMailAddress.Text = myDV(rowIndex)("E-MAIL_ADDRESS").ToString()

Fil_Name()

'UpdateScreen(irow)

Catch ex As Exception

MessageBox.Show("Failed to connect to data source")

Finally

conn.Close()

End Try

End Sub

Steve

"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:ub**************@TK2MSFTNGP02.phx.gbl...
Stephen,

Sorry for my misunderstanding.
Are you using exactly the same code, because this is the first time I
read about your problem.

Cor

"Cor Ligthert [MVP]" <no************@planet.nlschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
Stephen,
>
>>IS there something that could be causing this problem?
>
Yes a lot, but in most cases (not all) VBNet is faster.
>
Can you show a piece of your code that does the fill of the datagrid?
(only VBNet although I am curious how you use that datagrid in VB6)
>
>
Cor
>
"Stephen Plotnick" <sp*******@groupcbf.comschreef in bericht
news:Nd******************************@giganews .com...
>>I upgraded from VB 2003 to VB 2005.
>>
>I have a 4000 record table in Access that I'm using oleDB to do a
>data adapter fill to a Data Grid. In VB.2003 it takes 2-3 seconds to
>load the data grid in vb 2005 it takes aroudn 20 seconds. IS there
>something that could be causing this problem?
>>
>
>




Aug 8 '06 #11

P: n/a

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.comwrote in message news:OO*************@TK2MSFTNGP06.phx.gbl...
"GhostInAK" <gh*******@gmail.comwrote in message
fwiw, I'd like to see any dotNet code run faster than a fully compiled and
optimized VB6 version of that same code. Heck... I'd like to see a dotNet
IDE that starts up in less time than it takes to make a cup of coffee. Oh
well... Quad core CPUs are coming out soon. Maybe then we'll see 386 era
performance from a dotNet app.

--
Ken Halter -

I'm having a hard time trying to figure out if you like .net or not Ken...


--
Posted via a free Usenet account from http://www.teranews.com

Aug 8 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.