Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 23rd, 2007, 07:27 PM
Registered User
 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default IDbCommand Interface

I need to create a class to connect two databases (SQL & Sybase). Also execute Stored procedure and sql statements.

I'm using the interface IDbCommand to set the object command created depends on the dabase selected.

I have a Sybase stored procedure with one input parameter and one output parameter. I created two object ASEParameter and set at the Parameter's interface property.

When I execute the SP using the ExecuteNonQuery method, I check the value's output parameter
and it returns

'((Sybase.Data.AseClient.AseParameter)((new System.Collections.ArrayList.ArrayListDebugView(_o Comando.Parameters)).Items[1])).Value' threw an exception of type 'System.NullReferenceException'

But when I do the same procedure using SqlParameters and SQL Server stored procedure, it returns a correct value.

What it's the difference?

Whats wrong?

Regards

 
Old October 24th, 2007, 03:14 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You need to do some checking to find out what exactly is null.

Is _oCommando null?
Is _oCommando.Parameters null?
Is _oCommando.Parameters.Count equal to 2?
Is _oCommando.Parameters[1] of type AseParameter?
Is _oCommando.Parameters[1].Value null?

Obvious if its the latter then your stored procedure isn't setting the return value properly by the looks of it.


/- Sam Judson : Wrox Technical Editor -/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Role of interface ajit Java Databases 1 July 1st, 2006 08:15 PM
Multilanguage Interface tiyyob .NET Framework 2.0 1 June 14th, 2006 01:03 AM
user interface Kasia Access VBA 6 March 14th, 2005 09:52 AM
interface inheritance draganmit VB.NET 2002/2003 Basics 6 April 29th, 2004 09:40 AM
Regarding Interface ndr1977 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 July 30th, 2003 09:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.