473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Object Must Implement IConveritble (Application Blocks error)

I am using the Microsoft Application Data Block and am getting the
following error when trying to return a DataSet.

Object must implement IConvertible

Here is the code where the error occurs:

private DataSet getResults(string sd, string ed)
{
DataSet dsresults=new DataSet();
dsresults=SqlHelper.ExecuteDataset(
connection,
"prRedDecisions",
new SqlParameter("@startdate",DateTime.Parse(sd)),
new SqlParameter("@enddate",DateTime.Parse(ed))
);
return dsresults;
}

When not converting the Sql parameters to datetime, the error occurs
within the Application block itself. This tempts me to just go back to
the "old way" of doing thinkgs. Has anybody else had this problem or
know a solution? Thanks...

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 1393
Whenver this has happened to me it was because of incorrect parameter
values.

What you may try to do instead is to have the application block create the
parameters for you using the parameter cache functions. You can create a
SqlParameter array called parameters to store them liek so:

SqlParameter[] parameters =
Microsoft.ApplicationBlocks.Data.SqlHelperParamete rCache.GetSpParameterSet(_
ConnectionString,_SPName,false);

parameters[0].Value = Convert.ToDateTime(sd);
parameters[1].Value = Convert.ToDateTime(ed);

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Philip Townsend" <pt*******@v1tech.com> wrote in message
news:O7**************@TK2MSFTNGP11.phx.gbl...
I am using the Microsoft Application Data Block and am getting the
following error when trying to return a DataSet.

Object must implement IConvertible

Here is the code where the error occurs:

private DataSet getResults(string sd, string ed)
{
DataSet dsresults=new DataSet();
dsresults=SqlHelper.ExecuteDataset(
connection,
"prRedDecisions",
new SqlParameter("@startdate",DateTime.Parse(sd)),
new SqlParameter("@enddate",DateTime.Parse(ed))
);
return dsresults;
}

When not converting the Sql parameters to datetime, the error occurs
within the Application block itself. This tempts me to just go back to
the "old way" of doing thinkgs. Has anybody else had this problem or
know a solution? Thanks...

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: KevinBradly | last post by:
Building and running a VB or C# graphics application within VisStudio is fine. Running the .exe outside VisStudio on the same machine is fine. But trying to run the .exe on another machine produces...
6
by: ChrisB | last post by:
Hello All: I notice that when using try/catch blocks in C#, variables declared in the try block go out of scope in the finally block. So, for example, the following code generates a compiler...
5
by: PCC | last post by:
I am using the Exception Managment Application Block on Windows Server 2003 Enterprise and .NET v1.1. If I use the block with an ASP.NET web wervice or in a web application I get the following...
5
by: Tiago Costa | last post by:
Hi all!!! My problem is this: When i build an object, and after i used, should i destroy the obejct (like the dispose method) Or just this command is enouth: object = null;
3
by: Martin Knopp | last post by:
Anybody here can shed some light on this issue? Is it at all possible to call out-of-proc COM objects from ASP.NET? If yes, what configuration settings are required? I played around many...
5
by: Michael Moreno | last post by:
Hello, In a class I have this code: public object Obj; If Obj is a COM object I would like to call in the Dispose() method the following code: ...
8
by: fniles | last post by:
I have a collection inside a class, sometimes when I add to the collection, I get the error "At least one object must implement IComparable". What does the error mean ? Thanks. Public Class...
1
slapshock
by: slapshock | last post by:
hi.... i am using validation application blocks on my project on C#.net... i want to validate one of my textbox which is cost but ht e problem is i got an error... when i input numbers, the...
3
by: Daniel Knöpfel | last post by:
Hi We have to decided to use standard .net components for logging our asp.net application (rather than log4.net or microsoft logging application blocks): i tried to implement our logging using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.