|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Speed in VB 2005I 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? 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 Show quoteHide quote "Stephen Plotnick" <splotn***@groupcbf.com> schreef in bericht news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? > Hello Cor Ligthert [MVP],
*pokes* Cor, There was no VB6 mentioned. I know 2003 was a long time ago.. -Boo Show quoteHide quote > 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" <splotn***@groupcbf.com> schreef in bericht > news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >> "GhostInAK" <ghosti***@gmail.com> wrote in message fwiw, I'd like to see any dotNet code run faster than a fully compiled and news:be1391bf127268c88833fc2fc983@news.microsoft.com... > Hello Cor Ligthert [MVP], > > *pokes* Cor, There was no VB6 mentioned. I know 2003 was a long time > ago.. > > -Boo 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 "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message news:OOAQeGmuGHA.324@TK2MSFTNGP06.phx.gbl... I'm having a hard time trying to figure out if you like .net or not Ken...> "GhostInAK" <ghosti***@gmail.com> wrote 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 - Hi,
Boo, you are right, I don't know where I got that VB6.. Cor Show quoteHide quote "GhostInAK" <ghosti***@gmail.com> schreef in bericht news:be1391bf127268c88833fc2fc983@news.microsoft.com... > 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" <splotn***@groupcbf.com> schreef in bericht >> news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >>> > > Stephen,
Sorry for my misunderstanding. Are you using exactly the same code, because this is the first time I read about your problem. Cor Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schreef in bericht news:O9pPH0luGHA.1288@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" <splotn***@groupcbf.com> schreef in bericht > news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >> > > 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=Microsoft.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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ubVr0amuGHA.4292@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]" <notmyfirstn***@planet.nl> schreef in bericht > news:O9pPH0luGHA.1288@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" <splotn***@groupcbf.com> schreef in bericht >> news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >>> >> >> > > 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.OLEDB.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 Show quoteHide quote "Stephen Plotnick" <splotn***@groupcbf.com> schreef in bericht news:rJudnbwVkc_lWkrZnZ2dnUVZ_sidnZ2d@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=Microsoft.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]" <notmyfirstn***@planet.nl> wrote in message > news:ubVr0amuGHA.4292@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]" <notmyfirstn***@planet.nl> schreef in bericht >> news:O9pPH0luGHA.1288@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" <splotn***@groupcbf.com> schreef in bericht >>> news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >>>> >>> >>> >> >> > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:O50AohtuGHA.5056@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.OLEDB.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" <splotn***@groupcbf.com> schreef in bericht > news:rJudnbwVkc_lWkrZnZ2dnUVZ_sidnZ2d@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=Microsoft.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]" <notmyfirstn***@planet.nl> wrote in message >> news:ubVr0amuGHA.4292@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]" <notmyfirstn***@planet.nl> schreef in bericht >>> news:O9pPH0luGHA.1288@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" <splotn***@groupcbf.com> schreef in bericht >>>> news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >>>>> >>>> >>>> >>> >>> >> >> > > Stephen,
I don't know if the method with the datareader will help you. http://msdn2.microsoft.com/en-us/library/system.data.datatable.load.aspx I did not test that. Cor Show quoteHide quote "Stephen Plotnick" <splotn***@groupcbf.com> schreef in bericht news:X8-dnTVEW-OK5kXZnZ2dnUVZ_v2dnZ2d@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]" <notmyfirstn***@planet.nl> wrote in message > news:O50AohtuGHA.5056@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.OLEDB.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" <splotn***@groupcbf.com> schreef in bericht >> news:rJudnbwVkc_lWkrZnZ2dnUVZ_sidnZ2d@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=Microsoft.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]" <notmyfirstn***@planet.nl> wrote in message >>> news:ubVr0amuGHA.4292@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]" <notmyfirstn***@planet.nl> schreef in bericht >>>> news:O9pPH0luGHA.1288@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" <splotn***@groupcbf.com> schreef in bericht >>>>> news:NdCdnfCl87E2B0rZnZ2dnUVZ_vydnZ2d@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? >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > On Mon, 7 Aug 2006 14:55:17 -0500, "Stephen Plotnick" <splotn***@groupcbf.com> wrote: ¤ 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)
Get Application EXE name in VS.2005
Textbox LostFocus event fires after Command Button's OnClick event About Adding controls dynamically VB6 and ms SQL 2005 DATETIME Messagebox Issue Variable function activation select stmt Delay in making control visible when connecting to database Sending an e-mail on a wireless network Cool Interview Questions Link |
|||||||||||||||||||||||