When i query the database to show all rows in a table, I only get "1 of 1" on my binding navigator and the navigation arrows are disabled. There's supposed to be over 500 records. I've checked the table name and passwords. Anyone know why this is happening?
Access database version: 2000, can't upgrade either.
Using vb.net 2005 express
Here's the code:
Code:Imports System.Data.Oledb Imports System.Windows.Forms Module modLeads Public mystr As String Public myDS As DataSet Public myDA As OleDbDataAdapter Public ConnString As String Public connection As OleDbConnection Public sUser As String 'user name Public sAccountType As String 'account type Public sAppPath As String 'location of the application Public sFormName As String 'form name Public leadsBinding As New BindingSource() End ModuleCode:Imports System.Data.Oledb Imports System.Windows.Forms Public Class frmLeadsView Private Sub frmLeadsView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'open the database to begin looking for information On Error GoTo nodb ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sAppPath & "\master.mdb;Persist Security Info=False;Jet OLEDB:Database Password=******" connection = New OleDb.OleDbConnection connection.ConnectionString = ConnString connection.Open() 'create the appropriate search string and search On Error GoTo badsql mystr = "SELECT * from leads" myDA = New OleDbDataAdapter(mystr, connection) myDS = New DataSet myDA.Fill(myDS, "leads") connection.Close() On Error GoTo showerror bnvLeads.BindingSource = leadsBinding leadsBinding.DataSource = myDS lblName1.DataBindings.Add(New Binding("text", leadsBinding, "name1", False)) nodb: 'caught a databse error: couldn't find the database file MsgBox("Unable to find database. Please see system administrator. " & My.Application.Info.DirectoryPath & "\employee.mdb", MsgBoxStyle.Critical, sFormName) 'get out of the sub to prevent further errors.. Exit Sub badsql: 'caught a problem with the sql statement! MsgBox("Unable to query database. Please see system administrator. " & Chr(10) & "Error Numer: " & Err.Number & Chr(10) & "Description: " & Err.Description & Chr(10) & mystr, MsgBoxStyle.Critical, sFormName) 'get out of the sub to prevent further errors... Exit Sub showerror: MsgBox("General error. Please see system administrator. " & Chr(10) & "Error Numer: " & Err.Number & Chr(10) & "Description: " & Err.Description, MsgBoxStyle.Critical, sFormName) End Sub End Class




Reply With Quote