Please refrain from posting animated GIFs, memes, joke videos and so on in discussions other than those in the off topic area.

Dismiss this message to confirm your acceptance of this additional forum term of use.
You must be 16 or over to participate in the Brickset Forum. Please read the announcements and rules before you join.

API Call GetSets giving SQL Error

CheaterCheater TurkeyMember Posts: 3
I was trying to use the API but getting an error message.
I simply call the following function

service.getSets(apiKey, userHash, "", "", "", "", "", "1", "", "", "100000", "", username)

and getting the following error. (Much longer but summarized for you)

"System.Data.SqlClient.SqlException: Parameter '@Owned' was supplied multiple times."

When i leave the owned parameter blank ,everything is fine but when i pass it as "1" it gives error. Did anyone experienced that or know the workaround for that?. Full error is below.

An exception of type 'System.Web.Services.Protocols.SoapException' occurred in System.Web.Services.dll but was not handled in user code

Additional information: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Parameter '@Owned' was supplied multiple times.

at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()

at System.Data.SqlClient.SqlDataReader.get_MetaData()

at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)

at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)

at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)

at System.Data.SqlClient.SqlCommand.ExecuteReader()

at BricksetAPIv2.readRecords(SqlCommand command, Boolean includeExtendedData, Boolean includeCollectionData) in C:\Inetpub\vhosts\brickset.com\httpdocs\App_Code\vb\webServices\v2.vb:line 371

at BricksetAPIv2.getSets(String apiKey, String userHash, String query, String theme, String subtheme, String setNumber, String year, String owned, String wanted, String orderBy, String pageSize, String pageNumber, String userName) in C:\Inetpub\vhosts\brickset.com\httpdocs\App_Code\vb\webServices\v2.vb:line 269

--- End of inner exception stack trace ---

Comments

  • HuwHuw Brickset Towers, Hampshire, UKAdministrator Posts: 5,797
    As I replied to you by email I don't know why this is. Sorry I can't help but hopefully someone who actually uses the API can.
  • CheaterCheater TurkeyMember Posts: 3

    Yes Huw i know and thank you for your reply. I thought somebody else try this with their API and tell me if they are getting the same error.


    As i said in the email, as a software engineer i don't think i should be getting an SQL error from webservice since i don't have direct Access to it.


    Just trying my luck here. Thanks again.

  • HuwHuw Brickset Towers, Hampshire, UKAdministrator Posts: 5,797
    edited August 2016
    Actually you have a point about the error being a bit explicit. The try...catch had been commented out for some reason. I'll get that sorted which will hopefully prevent the error message but it won't solve your problem.

    Looking at the code where it occurs and the error message, it appears that the method is being called with the owned parameter specified twice which is causing it to be added to the stored procedure parameters twice, and I have no idea how you'd manage to do that!
  • CheaterCheater TurkeyMember Posts: 3

    Let me see the code, and i will tell the problem :p


    Anyways, thanks again and again. I will try to see if i can call the function in another way with other optional parameters passed etc.

Sign In or Register to comment.
Recent discussions Categories Privacy Policy