# How to execute a stored proc directly from a .NET IDataAbstractService object

**URL:** https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095
**Category:** Data Abstract
**Tags:** net
**Created:** [March 18, 2026, 3:28pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095 "2026-03-18T15:28:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [March 18, 2026, 3:28pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/1 "2026-03-18T15:28:11Z")

</div>

For now I have some code that does something in case IDataAbstractService is DataAbstractService but it throws an exception : “expects parameter ‘@Primkey’, which was not supplied.”

I tried both the parameter with and without @

 ![image](https://talk.remobjects.com/uploads/default/original/3X/d/a/da069e8380da6f93670526b08757d7a4cf138b8b.png)

Note: I am trying to call the MS SQL stored proc directly, I don’t have a command in my DA schema

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [March 18, 2026, 4:27pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/2 "2026-03-18T16:27:24Z")

</div>

Hi,

I can suggest to use `Connection.GetCommandParams(..., true)` instead of creating params with `SchemaParametercollection`.

it calls `BaseConnection.GetStoredProcedureParams` internally and should returns all parameters of SP.

---

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [March 20, 2026, 1:52pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/3 "2026-03-20T13:52:14Z")

</div>

Hi,

The GetCommandParams works but I still have the same issue when I call ExecuteScalar

Is ExecuteScalar the correct function for SP? Should I use ExecuteNonQuery?

 ![image](https://talk.remobjects.com/uploads/default/original/3X/e/f/ef4821529d8ea30da33aef203adff004b09462c7.png)

Note: Maybe an alternative approach exists. Can I acquire a System.Data.SqlClient connection from the IDataAbstractService

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [March 20, 2026, 2:00pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/4 "2026-03-20T14:00:29Z")

</div>

Hi,

we use `ExecuteNonQuery` internally. You can see usage of it in `DataAbstractService.InternalExecuteCommand`.

Does this SP work w/o DataAbstract code?

Can you should DDL of this SP?

You can drop email to support@ for keeping privacy.

---

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [March 20, 2026, 2:53pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/5 "2026-03-20T14:53:36Z")

</div>

Yes,

this SP is in use for many years.

The GetStoredProcedureParams returns 3 parameters

We use it in our delphi RO server (where we made it a command)

 ![image](https://talk.remobjects.com/uploads/default/original/3X/2/1/21d41187c2b1f83b135c24bd0e3d4779c7e1297b.png)

 ![image](https://talk.remobjects.com/uploads/default/original/3X/c/0/c0fe78ddab57991543f4e6bf3b660294da312f2e.png)

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [March 20, 2026, 3:53pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/6 "2026-03-20T15:53:59Z")

</div>

Hi,

will this SP work if it is called with standard [RemoteCommand](https://docs.dataabstract.com/API/NET/Classes/RemoteCommand) / [LocalCommand](https://docs.dataabstract.com/API/NET/Classes/LocalCommand/)?

---

<div class="post-metadata">

### Author: ![fvancrae](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/f/ad7895/32.png) [@fvancrae](https://talk.remobjects.com/u/fvancrae)
#### Post date: [March 23, 2026, 12:43pm UTC](https://talk.remobjects.com/t/how-to-execute-a-stored-proc-directly-from-a-net-idataabstractservice-object/33095/7 "2026-03-23T12:43:34Z")

</div>

FYI: I found a solution:

It turns out setting the value in spparams before creating the cmd does not propagate these values

var cmd = con.NewCommand(storedProcName, CommandType.StoredProcedure, spparams, null);

If I set the values afterwards via cmd.Parameters the stored proc works.

Thanks
