CallRetrievalStoredProcedure Problem

Posts   
 
    
CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 11-Aug-2006 12:34:33   

Can anyone please give me a quick response to a problem I've searched this site for answers to but with no success.

SQL Server 2000, Adapter. .NET 1.1

Calling CallRetrievalStoredProcedure, as in:-

public DataTable BookingSearch( string booking_ref, string websiteref, string client_firstname, string client_surname, string clientwebsiteemailaddress ) { DataAccessAdapter adapter = new DataAccessAdapter(); ... ... tblResults = RetrievalProcedures.BookingSearch( booking_ref, websiteref, client_firstname, client_surname, clientwebsiteemailaddress);

Fails always when the adapter.Fill(tableToFill); line in CallRetrievalStoredProcedure is called.

Error is 'System.Data.SqlClient.SqlException'

The sproc is a straightforward SELECT query with optional parameters, which works with no problem when exec'd in Query Analyser.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 11-Aug-2006 13:13:09   

What's the full exception given?

Frans Bouma | Lead developer LLBLGen Pro
CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 11-Aug-2006 13:41:30   

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.windows.forms.dll

Additional information: System error.

There nothing more than this in the trace output. I though it may be a permissions issue but I've checked EXEC permissions so I'm absolutely stuck.

Just tried a simple SELECT * FROM Table test and the call to this works OK so it must be something to do with the sproc itself.

CliffH
User
Posts: 52
Joined: 03-May-2006
# Posted on: 11-Aug-2006 14:06:56   

Sproc has five parameters. Supplied values are optional and set to null when not supplied. But here's the last few lines of the exception

Unhandled Exception: System.Data.SqlClient.SqlException: Procedure 'BookingSearch' expects parameter '@websitereference', which was not supplied. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)

When I run it with the first param it complains that the second paramater is not supplied. If I run it with the second parameter it tells me the first parameter is not supplied.

Unhandled Exception: System.Data.SqlClient.SqlException: Procedure 'BookingSearch' expects parameter '@booking_ref', which was not supplied.

Any idea what I'm doing wrong.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Aug-2006 13:46:24   

I think it's similar to the problem discussed in this thread: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6959

Frans Bouma | Lead developer LLBLGen Pro