Hello! Does the ADO driver support prepared statements at all, or am I doing something wrong? I'm experimenting with LibreOffice Basic and MS SQL Server 2008 R2, trying to read rows from a database with the ADO driver and a prepared statement. I have old ODBC code that works against MSSQL, but for some reason I can't get the ADO version to work. I have set up a simple test table (tbl1) like this: col1 (integer); col2 (varchar(12)) 1; aaaa 2; bbbb 3; cccc I'm trying to get a row from the table with a prepared statement like this: Sub test Dim DatabaseContext As Object Dim flatProp(0) As New com.sun.star.beans.PropertyValue Dim Connection As Object Dim Statement As Object Dim ResultSet As Object DatabaseContext = createUnoService("com.sun.star.comp.sdbc.ado.ODriver") Connection = DatabaseContext.connect("sdbc:ado:PROVIDER=sqloledb;DATA SOURCE=myserver;INITIAL CATALOG=mydb;USER ID=user;PASSWORD=pwd", flatProp()) Statement = Connection.prepareStatement("SELECT col1 FROM tbl1 WHERE col2 = ?") Statement.setString(1, "bbbb") ResultSet = Statement.executeQuery() MsgBox ResultSet.getString(1) End Sub When I run the script, I get a com.sun.star.sdbc.SQLException (Incorrect syntax near ':'..) at the executeQuery() line. If I replace the question mark in the query with 'bbbb' the code works fine. -- View this message in context: http://nabble.documentfoundation.org/SQLException-when-using-ADO-driver-and-prepared-statements-tp4070605.html Sent from the Users mailing list archive at Nabble.com. -- To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted