vb.net - "The Microsoft.ACE.OLEDB.12.0 provider is not installed on your local machine" Exception is thrown while connecting to Access database -
i've been trying connect microsoft database file visual basic application.
but when try connect using code, runs click button check credentials crashes (visual studio says crashes in bold area)
code:
dim con new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=p:\pos system\pos system database.mdb") dim cmd oledbcommand = new oledbcommand("select * login info username = 'user" & txtstaffid.text & "' , password = 'user" & txtpassword.text & "' ", con) con.open() dim sdr oledbdatareader = cmd.executereader() if (sdr.read() = true) 'pass verification , go main form. me.hide() else msgbox("sorry, username or password incorrect.", msgboxstyle.critical, "information") end if
but when try connect through wizard, error:
the microsoft.ace.oledb.12.0 provider not installed on local machine
does have idea?
had issue yesterday. install 2007 office system driver , restart visual studio.
btw, better practice use executescalar()
in order to find match between user , password in login form:
dim result integer = 0 dim con new oledbconnection("provider=microsoft.jet.oledb.4.0;data source=p:\pos system\pos system database.mdb") dim cmd oledbcommand = new oledbcommand("select count(*) login info username = 'user" & txtstaffid.text & "' , password = 'user" & txtpassword.text & "' ", con) con.open() result = directcast(cmd.executescalar(), integer) con.close() if result > 0 'pass verification , go main form. me.hide() else msgbox("sorry, username or password incorrect.", msgboxstyle.critical, "information") end if
Comments
Post a Comment