CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.microsoft_application_blocks Tags:
Item Type: NewsGroup Date Entered: 10/8/2003 2:51:28 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 25 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
JeffKimbel
Asp.Net User
"Object must implement IConvertible" error10/8/2003 2:51:28 AM

0/0

I keep getting the "Object must implement IConvertible" error using any of the DAAB access methods. I'm using DAAB v.2.0. I'm guessing I'm doing something stupid, but after a lot of experimentation I'm not getting anywhere. Any help is appreciated.

// Inputs: keyFieldValue = "200"
// strTableName = "Table55"

public DataRow FindRow( string keyFieldValue, string strTableName)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConnectionString;
conn.Open();

string procName = "Get" + strTableName;

SqlCommand cmd = new SqlCommand(procName, conn);
cmd.CommandType = CommandType.StoredProcedure;

SqlParameter [] arParms = new SqlParameter[2];

arParms[0] = new SqlParameter("@KeyFieldValue", SqlDbType.NVarChar, 20);
arParms[0].Value = keyFieldValue;

arParms[1] = new SqlParameter("@FirstRow", SqlDbType.Binary );
arParms[1].Value = 0;

object foundObj = SqlHelper.ExecuteScalar(ConnectionString, "Get" + strTableName,
arParms);

if (foundObj != null)
return (DataRow) foundObj;
else
return null;
}

PROCEDURE dbo.GetTable55
(
@KeyFieldValue nvarchar(20) = null,
@FirstRow bit = 0
)
AS
IF @FirstRow = 0
SELECT * FROM Table55 WHERE CCC_Plan_Sequence = CAST(@KeyFieldValue AS float)
ELSE
SELECT TOP 1 * FROM Table55
/* SET NOCOUNT ON */
RETURN
Weston Binford
Asp.Net User
Re: "Object must implement IConvertible" error10/8/2003 5:21:22 PM

0/0


You are using a SqlParameter object array, but calling the overloaded method of ExecuteScalar that takes a generic object array.

You need to call the following method:

SqlHelper.ExecuteScalar(ConnectionString, CommandType.StoredProcedure, GetTable55, arParms)

-Weston


Weston Binford

Trason Consulting, Inc.

[email protected]

(yes, it is a real e-mail address)
JeffKimbel
Asp.Net User
Re: "Object must implement IConvertible" error10/9/2003 12:57:47 AM

0/0

Weston,

Thanks!! I knew it was something obvious. I just couldn't find it. I'll move onto the next stupid thing.

-- Jeff
3 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Error Using ODP.NET - dbTalk Databases Forums Hi , I am trying to connect to ORacle using ODP.NET. I am getting an &quot;Object must implement IConvertible&quot; error. I researched this issue
Object Must Implement Iconvertible Image Error &quot; Object must implement IConvertible&quot; Yes, I Recognize it. ... MSDN Visual Basic General Error " Object must implement IConvertible ...
MBR IT/.NET 247 : microsoft.public.dotnet.languages.vb Archive - May 2002 ... an SQL Server database but get an error &quot;Object must implement IConvertible.&quot; ... I have a Person object in the variable Person1 and I want to ...
ExamGuru IT/.Net Guru : ASPFriends.com 'aspngfreeforall' list ... code: Error Value null was found where an instance of an object was required. ... follwing error message means &quot;Object must implement IConvertible&quot; many ...
ExamGuru IT/.Net Guru : microsoft.public.dotnet.distributed_apps ... ... it fails with something like this: &quot;Object must implement IConvertible&quot; ... Or could there be something else causing this error. ...



 
All Times Are GMT