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
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]" <
[email protected]> schreef in bericht
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" <
[email protected]> schreef in bericht
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?