Idea Posted September 14, 2005 Share Posted September 14, 2005 (edited) My .au3 #include <sql.au3> Dim $oDBid $oDBid=_SQLOpen("C:\mydb.mdb") _SQLClose($oDBid) If you could please point out how I can fix my simple script that would be great! I've tried a few things based on results found via the search option but nothing seems to work. Example code (in AutoIt) for connecting to an Access database and adding values would be helpful, the posts I found via the search option are not working. The error is: Line 41 (File "C:\sql.au3"): $o_ADOrs.Open ($s_DSN) $o_ADOrs.Open ($s_DSN)^ERROR Error: The requested action with this object has failed. Edit: Removed the huge code file. Edited September 14, 2005 by Idea Link to comment Share on other sites More sharing options...
Developers Jos Posted September 14, 2005 Developers Share Posted September 14, 2005 maybe?: #include <sql.au3> $dbPath = "C:\mydb.mdb" Dim $mydb, $mydb=_SQLOpen("Driver={Microsoft Access Driver *.mdb)};Dbq=" & $dbPath & ";Uid=Admin;Pwd=;") _SQLQuery($mydb, "INSERT INTO ppl (Name,Car,House) VALUES ('John Doe','red, 'free')") SQLclose($mydb) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Idea Posted September 14, 2005 Author Share Posted September 14, 2005 (edited) maybe?:#include <sql.au3> $dbPath = "C:\mydb.mdb" Dim $mydb, $mydb=_SQLOpen("Driver={Microsoft Access Driver *.mdb)};Dbq=" & $dbPath & ";Uid=Admin;Pwd=;") _SQLQuery($mydb, "INSERT INTO ppl (Name,Car,House) VALUES ('John Doe','red, 'free')") SQLclose($mydb)<{POST_SNAPBACK}>Thanks for the quick reply! I'm still getting the same error.Update: Even with _SQLQuery commented out the error is still generated. Edited September 14, 2005 by Idea Link to comment Share on other sites More sharing options...
Developers Jos Posted September 14, 2005 Developers Share Posted September 14, 2005 (edited) Thanks for the quick reply! I'm still getting the same error.Update: Even with _SQLQuery commented out the error is still generated.<{POST_SNAPBACK}>Are you sure about this database string ? (see unbalanced red character)"Driver={Microsoft Access Driver *.mdb)};Dbq=C:\mydb.mdb;Uid=Admin;Pwd=;" Edited September 14, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Idea Posted September 14, 2005 Author Share Posted September 14, 2005 (edited) Are you sure about this database string ? (see unbalanced red character)"Driver={Microsoft Access Driver *.mdb)};Dbq=C:\mydb.mdb;Uid=Admin;Pwd=;"<{POST_SNAPBACK}>Even with that remove the error is the same. Just these four lines also generate the same error. I don't know how to fix it. #include <sql.au3> Dim $oDBid $oDBid=_SQLOpen("C:\mydb.mdb") _SQLClose($oDBid)Example code (in AutoIt) for connecting to an Access database and adding values would be helpful. Thanks. Edited September 14, 2005 by Idea Link to comment Share on other sites More sharing options...
Developers Jos Posted September 14, 2005 Developers Share Posted September 14, 2005 Even with that remove the error is the same. <{POST_SNAPBACK}>What i find is that it should have the format :"Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydb.mdb"Example code (in AutoIt) for connecting to an Access database and adding values would be helpful. Thanks.<{POST_SNAPBACK}>It is not support by AutoIt standard functions or UDF's... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
theguy0000 Posted September 14, 2005 Share Posted September 14, 2005 I know the problem...i think...you are using the syntax from the sql.au3 that I made, but a different sql.au3 file, mayve you just saw it in that post.download my sql.au3 [link] and put it in your include directory, so replace i with whatever sql.au3 you have.then again, it could be a completely different problem. but that syntax that you're using looks very simalar to mine The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Idea Posted September 15, 2005 Author Share Posted September 15, 2005 I know the problem...i think...you are using the syntax from the sql.au3 that I made, but a different sql.au3 file, mayve you just saw it in that post.download my sql.au3 [link] and put it in your include directory, so replace i with whatever sql.au3 you have.then again, it could be a completely different problem. but that syntax that you're using looks very simalar to mine <{POST_SNAPBACK}>The function _SQLOpen isn't even included in the file you linked. The _SQLConnect function that is in there simply will not work with access as far as I can tell from testing. Thanks for yuor effort. Link to comment Share on other sites More sharing options...
sykes Posted September 16, 2005 Share Posted September 16, 2005 (edited) Here one of my common ways to connect to mdb files: $oSa = ObjCreate("ADODB.Connection") $oSa.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & @ScriptDir & "\mydb.mdb") $oSa.Execute("INSERT INTO ppl (Name,Car,House) VALUES ('John Doe','red', 'free')") $oSa.Close Edit: Oops ... Found a typo in da code ... red was missing a closing ' Edited September 16, 2005 by sykes We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now