Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use DataConnectionExtensions.ExecuteProc()? #11

Open
journger opened this issue Jan 3, 2019 · 2 comments
Open

How to use DataConnectionExtensions.ExecuteProc()? #11

journger opened this issue Jan 3, 2019 · 2 comments

Comments

@journger
Copy link

journger commented Jan 3, 2019

I am trying to get hang of linq2db, but can't find any real examples.
for example I am trying to run a stored procedure (see below), however it does not seem to fire.

int x = DataConnectionExtensions.ExecuteProc(connection, "spName", DataParameter.Varchar("whateverParamName", "whateverParamValue"))
I am passing the parameters the right way?
Like sql, should it be EXEC spName @whateverParamName or is it ok
When I specify dataparameter do I need to specify with @? like @whateverParamName (DataParameter.Varchar("@whateverParamName", "whateverParamValue"))

Any guidance would be much appreciated.

@sdanyliv
Copy link
Member

sdanyliv commented Jan 3, 2019

@journger, looks like you have to pass @ sign. Everything depends on data provider.
Many samples of code usage are located in our tests. So it is better to clone linq2db repo and analyse linq2db.sln.

Also T4 generator may generate procedure stubs automatically from real database.

@MaceWindu
Copy link
Contributor

MaceWindu commented Jan 3, 2019

Yep, we have inconsistency here. For ExecuteProc you need to specify parameter name with provider-specific parameter marker, e.g. @, but when you use parameter in query, linq2db adds marker for you.
We definitely have area for improvement here.

@MaceWindu MaceWindu transferred this issue from linq2db/examples May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants