How do I call a stored procedure

Posts   
 
    
jrg
User
Posts: 10
Joined: 12-Oct-2018
# Posted on: 12-Oct-2018 02:08:25   

Hi,

How do I call a stored procedure? Do I use the adapter thing (whatever that is?) I don't get it. What's the difference between adapter and retrieval procedures?

Also, I am trying to understand LLBlgen. I am reading your documentation, and I can't make much sense of it. I don't really have any idea what I am doing.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Oct-2018 08:02:07   

Hi jrg,

What do you have so far? Did you already create a LLBLGen project in LLBLGen Designer? If so, Did you already generated code?

What part of the documentation didn't make sense? Did you start from the beginning?

I would recommend to start from here: - Quickstart videos - Tutorials and examples

Hope that helps. Please keep us posted about it.

David Elizondo | LLBLGen Support Team
jrg
User
Posts: 10
Joined: 12-Oct-2018
# Posted on: 25-Oct-2018 01:51:24   

daelmo wrote:

Hi jrg,

What do you have so far? Did you already create a LLBLGen project in LLBLGen Designer? If so, Did you already generated code?

What part of the documentation didn't make sense? Did you start from the beginning?

I would recommend to start from here: - Quickstart videos - Tutorials and examples

Hope that helps. Please keep us posted about it.

Hi, I know how to do it now. You just need to click a fairly long and complicated sequence of buttons, which has gotten me to this point:

DataTable data = IVRDA.RetrievalProcedures.IvrOrdcre1(PSNo,customerNo, callingCountry)

but now i am getting an exception with error message "Connection string is invalid"

Here are the details of the exception:

at Sybase.Data.AseClient.ConnectionProperties.set_FullString(String value) at Sybase.Data.AseClient1.AseConnection.set_ConnectionString(String value) at Sybase.Data.AseClient.AseConnection.set_ConnectionString(String value) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateNewPhysicalConnection(String connectionString) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3512 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateStoredProcedureCallCommand(String storedProcedureToCall, DbParameter[] parameters) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3339 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CallRetrievalStoredProcedure(String storedProcedureToCall, DbParameter[] parameters, DataTable tableToFill) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 150 at SD.LLBLGen.Pro.ORMSupportClasses.StoredProcedureCall.FillDataTable() in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\StoredProcedureCall.cs:line 136 at OrYx.TVShopping.IVRDA.DatabaseSpecific.RetrievalProcedures.IvrOrdcre1(String aPsNo, Decimal aCustomerNo, String aCallingCountry, IDataAccessCore dataAccessProvider) in C:\OrYxdev\CSharp 2.0\TVShopping\IVRDA\DatabaseSpecific\RetrievalProcedures.cs:line 46 at OrYx.TVShopping.IVRDA.DatabaseSpecific.RetrievalProcedures.IvrOrdcre1(String aPsNo, Decimal aCustomerNo, String aCallingCountry) in C:\OrYxdev\CSharp 2.0\TVShopping\IVRDA\DatabaseSpecific\RetrievalProcedures.cs:line 32 at WebService.CreatePendingOrder(String PSNo, Decimal customerNo, String callingCountry) in c:\OrYxdev\CSharp 2.0\TVShopping\IVRWebService\App_Code\WebService.cs:line 151

jrg
User
Posts: 10
Joined: 12-Oct-2018
# Posted on: 25-Oct-2018 03:10:10   

jrg wrote:

daelmo wrote:

Hi jrg,

What do you have so far? Did you already create a LLBLGen project in LLBLGen Designer? If so, Did you already generated code?

What part of the documentation didn't make sense? Did you start from the beginning?

I would recommend to start from here: - Quickstart videos - Tutorials and examples

Hope that helps. Please keep us posted about it.

Hi, I know how to do it now. You just need to click a fairly long and complicated sequence of buttons, which has gotten me to this point:

DataTable data = IVRDA.RetrievalProcedures.IvrOrdcre1(PSNo,customerNo, callingCountry)

but now i am getting an exception with error message "Connection string is invalid"

Here are the details of the exception:

at Sybase.Data.AseClient.ConnectionProperties.set_FullString(String value) at Sybase.Data.AseClient1.AseConnection.set_ConnectionString(String value) at Sybase.Data.AseClient.AseConnection.set_ConnectionString(String value) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateNewPhysicalConnection(String connectionString) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3512 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CreateStoredProcedureCallCommand(String storedProcedureToCall, DbParameter[] parameters) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 3339 at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterCore.CallRetrievalStoredProcedure(String storedProcedureToCall, DbParameter[] parameters, DataTable tableToFill) in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\AdapterSpecific\DataAccessAdapterCore.cs:line 150 at SD.LLBLGen.Pro.ORMSupportClasses.StoredProcedureCall.FillDataTable() in C:\Myprojects\VS.NET Projects\LLBLGen Pro v5.2\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\StoredProcedureCall.cs:line 136 at OrYx.TVShopping.IVRDA.DatabaseSpecific.RetrievalProcedures.IvrOrdcre1(String aPsNo, Decimal aCustomerNo, String aCallingCountry, IDataAccessCore dataAccessProvider) in C:\OrYxdev\CSharp 2.0\TVShopping\IVRDA\DatabaseSpecific\RetrievalProcedures.cs:line 46 at OrYx.TVShopping.IVRDA.DatabaseSpecific.RetrievalProcedures.IvrOrdcre1(String aPsNo, Decimal aCustomerNo, String aCallingCountry) in C:\OrYxdev\CSharp 2.0\TVShopping\IVRDA\DatabaseSpecific\RetrievalProcedures.cs:line 32 at WebService.CreatePendingOrder(String PSNo, Decimal customerNo, String callingCountry) in c:\OrYxdev\CSharp 2.0\TVShopping\IVRWebService\App_Code\WebService.cs:line 151

I have fixed this. I just needed to add a variable to my *.config file with key ConnectionString.Sybase ASE (ASE Client) and with value of the connection string.

But now I get another error:

{"Stored procedure 'IvrOrdcre1' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).\n"}

So, any ideas?

It seems like LLBLGEN is trying to execute in Sybase a stored procedure named IvrOrdcre1. Obviously there is no such SP in Sybase. IvrOrdcre1 is just the name that I use in LLBLGEN for the SP that is actually called ivr_ordcre. Why is LLBLGEN doing this?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Oct-2018 07:25:24   

jrg wrote:

I have fixed this. I just needed to add a variable to my *.config file with key ConnectionString.Sybase ASE (ASE Client) and with value of the connection string.

Good that you figured it out simple_smile

jrg wrote:

But now I get another error:

{"Stored procedure 'IvrOrdcre1' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).\n"}

So, any ideas?

It seems like LLBLGEN is trying to execute in Sybase a stored procedure named IvrOrdcre1. Obviously there is no such SP in Sybase. IvrOrdcre1 is just the name that I use in LLBLGEN for the SP that is actually called ivr_ordcre. Why is LLBLGEN doing this?

This is actually an error coming from Sybase (Ref (Error 20sunglasses). So LLBLGen is just telling you what Sybase says.

What I think/guess is that the issue could be in the connection string. Please double check the details in your connection string: the database name, server and the user (check that the user used has permission to see the database and SPs that you generated.

IvrOrdcre1 according to the error, is the name sent in the query, however it's just what I think, I don't know your code. If it's so, maybe you put that name in the catalog explorer.

If possible, to validate these things, consider open a new Helpdesk Thread (which is private). There you can post your project or other information that could help to clarify what you are doing.

David Elizondo | LLBLGen Support Team
jrg
User
Posts: 10
Joined: 12-Oct-2018
# Posted on: 26-Oct-2018 03:11:54   

daelmo wrote:

jrg wrote:

I have fixed this. I just needed to add a variable to my *.config file with key ConnectionString.Sybase ASE (ASE Client) and with value of the connection string.

Good that you figured it out simple_smile

jrg wrote:

But now I get another error:

{"Stored procedure 'IvrOrdcre1' not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).\n"}

So, any ideas?

It seems like LLBLGEN is trying to execute in Sybase a stored procedure named IvrOrdcre1. Obviously there is no such SP in Sybase. IvrOrdcre1 is just the name that I use in LLBLGEN for the SP that is actually called ivr_ordcre. Why is LLBLGEN doing this?

This is actually an error coming from Sybase (Ref (Error 20sunglasses). So LLBLGen is just telling you what Sybase says.

What I think/guess is that the issue could be in the connection string. Please double check the details in your connection string: the database name, server and the user (check that the user used has permission to see the database and SPs that you generated.

IvrOrdcre1 according to the error, is the name sent in the query, however it's just what I think, I don't know your code. If it's so, maybe you put that name in the catalog explorer.

If possible, to validate these things, consider open a new Helpdesk Thread (which is private). There you can post your project or other information that could help to clarify what you are doing.

Hi, don't worry, I know what the issue is now.

Apparently LLBLGEN has a bug in it whereby it cannot translate the LLBLGEN name of a stored proc to the actual name. I have to fiddle with the auto generated code to make it work.

So it's fine, i guess.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 26-Oct-2018 09:41:42   

What do you mean, LLBLGen Pro has a bug? It might very well be the Sybase ADO.NET provider has a bug, which wouldn't be the first time...

What exactly should llblgen pro do which it doesn't (and therefore has a bug?) so we can correct it?

The name of the stored procedure call (in project explorer) isn't generated as the name of the stored procedure in the catalog explorer (the proc it is mapped on), if you look at the RetrievalProcedures.cs file which contain the code to call a proc, you'll see it generates a call to the proc with the name in the catalog explorer. If the name in the catalog explorer isn't correct, then it either pulls the wrong names or something else is wrong.

Keep in mind tho that you're using v5.x and we don't support sybase on v5. It's available through the code provided on GitHub (https://github.com/SolutionsDesign/LLBLGenProSybaseASA) and I don't know which version you're using from that code, but the port of that code to v5.x did contain some issues some time ago.

Frans Bouma | Lead developer LLBLGen Pro
jrg
User
Posts: 10
Joined: 12-Oct-2018
# Posted on: 29-Oct-2018 07:38:46   

Otis wrote:

What do you mean, LLBLGen Pro has a bug? It might very well be the Sybase ADO.NET provider has a bug, which wouldn't be the first time...

What exactly should llblgen pro do which it doesn't (and therefore has a bug?) so we can correct it?

The name of the stored procedure call (in project explorer) isn't generated as the name of the stored procedure in the catalog explorer (the proc it is mapped on), if you look at the RetrievalProcedures.cs file which contain the code to call a proc, you'll see it generates a call to the proc with the name in the catalog explorer. If the name in the catalog explorer isn't correct, then it either pulls the wrong names or something else is wrong.

Keep in mind tho that you're using v5.x and we don't support sybase on v5. It's available through the code provided on GitHub (https://github.com/SolutionsDesign/LLBLGenProSybaseASA) and I don't know which version you're using from that code, but the port of that code to v5.x did contain some issues some time ago.

Hi, I think I understand how the RetrievalProcedures.cs file works. Each stored proc has a method in that file, and one parameter to the method if the LLBLGEN name ,and another is the Sybase name. For some reason, the parameter containing Sybase name is an empty string for all of the methods in that file. To fix this, I manually edit the parameters so they contain the Sybase name.

I am using version 5.2.1 (that's the number in the top left of the designer GUI).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 29-Oct-2018 10:51:44   

jrg wrote:

Otis wrote:

What do you mean, LLBLGen Pro has a bug? It might very well be the Sybase ADO.NET provider has a bug, which wouldn't be the first time...

What exactly should llblgen pro do which it doesn't (and therefore has a bug?) so we can correct it?

The name of the stored procedure call (in project explorer) isn't generated as the name of the stored procedure in the catalog explorer (the proc it is mapped on), if you look at the RetrievalProcedures.cs file which contain the code to call a proc, you'll see it generates a call to the proc with the name in the catalog explorer. If the name in the catalog explorer isn't correct, then it either pulls the wrong names or something else is wrong.

Keep in mind tho that you're using v5.x and we don't support sybase on v5. It's available through the code provided on GitHub (https://github.com/SolutionsDesign/LLBLGenProSybaseASA) and I don't know which version you're using from that code, but the port of that code to v5.x did contain some issues some time ago.

Hi, I think I understand how the RetrievalProcedures.cs file works. Each stored proc has a method in that file, and one parameter to the method if the LLBLGEN name ,and another is the Sybase name.

yes, like this:


return new StoredProcedureCall(dataAccessProvider, @"[Northwind].[dbo].[pr_CustomersAndOrdersOnCountry]", "RawCustomersAndOrdersOnCountry")
                .AddParameter("@country", "VarChar", 50, ParameterDirection.Input, true, 0, 0, country);

where RawCustomersAndOrdersOnCountry is the mapped method name (in C#, the model element), and @"[Northwind].[dbo].[pr_CustomersAndOrdersOnCountry]" is the stored procedure name (in the DB).

For some reason, the parameter containing Sybase name is an empty string for all of the methods in that file. To fix this, I manually edit the parameters so they contain the Sybase name. I am using version 5.2.1 (that's the number in the top left of the designer GUI).

It's generated code, you never should edit that by hand/manually. Like I said, you use v5.x which has no support for Sybase ASE/ASA anymore and you have to use the Open sourced templates, drivers and DQE from github. These repositories contained some bugs/porting issues which have been addressed some time ago. Your templates are not correct, so I suggest you pull the right ones from github and try those. https://github.com/SolutionsDesign/LLBLGenProSybaseASA (the ones there are for 5.4, but should be portable to v5.2 easily. If anything, do a diff with the ones you have).

That said, I think this thread ends here, as Sybase ASA isn't supported anymore by LLBLGen Pro, so we can't give you any support on that database. But please: don't edit generated code, do the right thing: pull the latest templates from github, check whether they differ from the ones you have and use these instead to generate the proper code.

We try our best to keep the repository on github in sync so it's not the end of the world for users who want to use v5.x and have to use sybase/sap databases, but again, no support.

Frans Bouma | Lead developer LLBLGen Pro