GuilleRF Posted November 12, 2018 Posted November 12, 2018 After a couple of weeks searching on how to do this.. and trying to install sqlite unsuccesfully... I have decided to show you m code to see if ou can give me any help. I am making a small code justo to write into an existing database and to read from it. I am able to write into it with this code: $dbname = "BBDD.mdb" $tblname = "Clientes" Global $adoCon = ObjCreate ("ADODB.Connection") $query = "SELECT Nombre FROM Clientes" $adoCon.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbname) $adoRs = $adoCon.Execute($query) Dim $output While Not $adoRs.EOF $output = $output & $adoRs.fields("Nombre").value & @CRLF $adoRs.MoveNext WEnd $adoCon.Close ConsoleWrite($output) And following with this type of coding I wrote this code to write into the database: $dbname = "BBDD.mdb" $tblname = "Clientes" Global $adoCon = ObjCreate ("ADODB.Connection") $adoRs = ObjCreate ("ADODB.Recordset") $adoRs.CursorType = 2 Dim $name = "hola" $query = "INSERT INTO Clientes (Nombre, Apellido1, Apellido2, Telefono, Mail, Fecha) Values ("&$name&", ere, ere, eee, erer, ere);" ConsoleWrite($query) $adoCon.Open("Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & $dbname) $adoCon.Execute($query) $adoCon.Close When executing I get the following in the console: INSERT INTO Clientes (Nombre, Apellido1, Apellido2, Telefono, Mail, Fecha) Values (hola, ere, ere, eee, erer, ere);"C:\Users\Guillermo\Documents\kk2.au3" (11) : ==> The requested action with this object has failed.: $adoCon.Execute($query) $adoCon^ ERROR please send me any advice
water Posted November 12, 2018 Posted November 12, 2018 Welcome to AutoIt and the forum! Did you have a look at the wiki? There you find UDFs for MS Access and ADO in general. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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