ADO parameterised queries and return values
Back before ADO.NET, we used good old ADO to do our data access in our ASP pages. To improve performance and avoid SQL injection attacks, it is good practice to use parameterised queries or stored procedures. Usually these are interchangeable but I’ve noticed today that ADO throws up the following error if you try and set up a return value parameter:
Microsoft OLE DB Provider for SQL Server error ‘80040e21’
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
For example, the following code gives that error:
Set Cmd = Server.CreateObject(“ADODB.Command”) Cmd.ActiveConnection = conn
Dim ParamReturn Set ParamReturn = Cmd.CreateParameter(“Return”, adInteger, adParamReturnValue) Cmd.Parameters.Append ParamReturn Cmd.CommandText = “INSERT INTO table (col1) VALUES (?); RETURN SCOPE_IDENTITY()” Cmd.CommandType = adCmdText
Cmd.Parameters.Append Cmd.CreateParameter(“p1”, adInteger, adParamInput, , “value”)
I haven’t found any solution, other than to use a stored procedure instead. Presumably return values aren’t supported for plain parameterised queries, though I haven’t seen that documented anywhere (yet).
GMail contacts and Thunderbird
For a while now I’ve been using the Sync Kolab extension for Mozilla Thunderbird to synchronise changes to the Thunderbird Address Book.
This works quite well, but it only synchronises with other Thunderbird sessions. What I really wanted was to use the Contacts from GMail and synchronise with that. That way, whether I’m using Thunderbird, or just the GMail web interface, I’ll have the same details available for all the people in my contacts list. The problem is that Google hadn’t provided an API for accessing the Contacts data, but that all changed last month.
The good news is that Zindus are already working on a new extension for Thunderbird to synchronise with Google Contacts. I plan to try this out very soon.
There’s also support for the Contacts API in Google’s .NET Client Library, should you wish to use this in a .NET application.
SQL 2008 Reporting Services renderers
Yesterday I caught Keith’s talk on new features in SQL Server 2008 Reporting Services at the monthly meeting of the Adelaide SQL Server User Group. I must say, as someone who’s only just started using the original SQL 2000 Reporting Services a few weeks ago, I was drooling at the pretty new designer. Not to mention the new features and enhancements. Very nice!
Talking with my DECS colleagues this morning, the question of renderer support arose. Specifically will 2008 natively render reports as a Word document? (I understand that to do this previously, you needed to purchase 3rd party addins)
Turns out the answer is “Yes!”. As of the February 2008 CTP, the following renderings are supported:
- Windows Forms
- Web Forms
More details of the new features (grouped by CTP release) are published on the SQL Server 2008 TechNet site.