Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 23rd, 2007, 07:27 PM
Registered User
 
Join Date: Oct 2007
Location: , , Mexico.
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

  #2 (permalink)  
Old October 24th, 2007, 03:14 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
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 -/
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:20 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.