Object Must Implement IConvertible with MS Data Access Application Block

Date Published: 18 August 2003

Object Must Implement IConvertible with MS Data Access Application Block

Ran into this bug today. I’m not the first, as a quick google search found:

Google group thread.

Ted Graham also wrote about it, specifically for Access.

I think I’m close to finding the actual bug in the C# version of the DAAB, but I don’t have time to totally fix it just yet. However, I did find a workaround that I hope will help some folks. I was calling a stored procedure like so:

return SqlHelper.ExecuteDataset(ConnectionString, “usp_ListAuthors”, sqlArgs).Tables[0];

All I did to fix it was switch to another overload:

return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure, “usp_ListAuthors”, sqlArgs).Tables[0];

Simply specifying the CommandType fixed it. I’m sure the other version has a bug in it – if you have the exact fix, I’d love to hear it.

Thanks!

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.