ACCESS ADO Posted May 18, 2006 Posted May 18, 2006 Hi all, I have a very strange problem with accessing and reading from my access database. my .mdb file is password protected, the pass is "12345". ok, the code works fine when I want to read data from Table "SC" but when I want to read the data from Table "Groups" I cannot!!! you simply can replace this code with the one is my form_load event: and will see that it won't work anymore! pleassssseeeeeeee help meeeeeee! :( Dim STrPath = System.IO.Directory.GetCurrentDirectory & "\0.mdb" Try DB = New OleDbConnection("Provider=microsoft.jet.oledb.4.0; data source='" & STrPath & "';jet oledb:database password=12345") Dc = New OleDbCommand("Select * from Groups where GroupName<>null order by name asc") DB.Open() Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Information, "") End End Try Dc.Connection = DB Dim Dr As OleDb.OleDbDataReader = Dc.ExecuteReader GroupComboBox.Items.Clear() While Dr.Read GroupComboBox.Items.Add(Dr("GroupName")) End While DB.Close() MyProblem.zip Quote
kejpa Posted May 18, 2006 Posted May 18, 2006 Sounds like you're run into a common problem, the name of the table is a reserved word... Change the name of the table and try again. HTH /Kejpa Quote
ACCESS ADO Posted May 18, 2006 Author Posted May 18, 2006 perhaps no, when i change my code to refer to table "Groups", i get this error: - No value given for one or more required parameters. - Exactly for this line: - Dim Dr As OleDb.OleDbDataReader = Dc.ExecuteReader - I have changed the Table name, no luck! please help me:( Quote
kejpa Posted May 19, 2006 Posted May 19, 2006 Sorry, I was too quick in my assumptions :o The reason is in your code... Dc = New OleDbCommand("Select * from Groups where GroupName<>null order by name asc") when dealing with null you need to use is and is not like this Dc = New OleDbCommand("Select * from Groups where GroupName [i][u]is not[/u][/i] null order by name asc") HTH /Kejpa Quote
ACCESS ADO Posted May 19, 2006 Author Posted May 19, 2006 no luck! can you be so kind and test this on my attached example? many thanks Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.