Calling Stored Procedures

Hi

I have used Radzen (the original) and build some applications, it is nice to use Radzen out of the box but sometime I need to run Stored Procedures to fecth data or to store complex data in several tables.

So in old Radzen I know how it works but in Radzen Blazer Studio it works fine if I don't need to pass parameters.

So can anybody point me in the right direction?

If its a simple usp with parameters you just select the SQL usp when creating/updating the datasource and RBS will automatically create the model and service methods to access the usp.

Yes I got that.

    public async Task<H3.Models.Hamntillsyn.HarbourSupervision>

GetHarbourSupervisionById(int id)
{
var items = Context.HarbourSupervisions
.AsNoTracking()
.Where(i => i.Id == id);

        items = items.Include(i => i.Member);
        items = items.Include(i => i.Member1);

        OnGetHarbourSupervisionById(ref items);

        var itemToReturn = items.FirstOrDefault();

        OnHarbourSupervisionGet(itemToReturn);

        return await Task.FromResult(itemToReturn);
    }

But how can I use it from a button click?

You need to invoke the method that has been generated. Nothing fancy there.

Hi the method does not appear in the drop down and when I type the name it is not found. I must have mist something

You need to inject the data service that was generated for your data source. Then you can invoke its methods. You can copy it from another page which already performs data access. It is a property that should look something like this:

[Inject]
public NorthwindService NorthwindService { get; set; }

Hi

Found it, thanks!!