Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:35:28+00:00 2026-05-23T17:35:28+00:00

Why dynamic SQL does not work ?? code in C# : this.DataAccess.AddParametr(@where,WHERE ta.IdMoinRef in(112,113,115));

  • 0

Why dynamic SQL does not work ??

code in C# :

 this.DataAccess.AddParametr("@where","WHERE ta.IdMoinRef in(112,113,115)");

code in sqlServer:

ALTER Procedure [dbo].[sp_tblAsnad_SelectAllForReport]
@where nvarchar(max)
As
Begin                                       
Select
        ta.IdMoinRef,
        ta.IdTafzeliRef,
        ta.ShHesab,
        ta.Bd,
        ta.Bs,
        ta.ShSnd,
        ta.AtfSnd,
        ta.DateSnd,
        mo.Hmoin,
        co.Hcol,
        gr.Hgroup,
        co.IdGroupRef,
        mo.IdColRef
    From tblAsnad as ta
    inner join tblMoin as mo on ta.IdMoinRef=mo.IdMoin
    inner join tblCol as co on mo.IdColRef=co.IdCol
    inner join tblGroup as gr on co.IdGroupRef=gr.IdGroup
    exec(@where)
End
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:35:29+00:00Added an answer on May 23, 2026 at 5:35 pm

    You’re confused. You need to encapsulate your entire statement into a command. You’re attempting to execute one query and then an additional query. You need to parse your main query together with your parameter, e.g.

    DECLARE @sql VARCHAR(1000)
    SET @sql = "SELECT ... " + @where -- Your full query.
    exec(@sql)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make sure AJAX responses from dynamic JSON pages does not slow
I wanted to convert my existing stored procedures to LINQ-to-SQL Precompiled Dynamic SQL. Does
In short, C# throws me Dynamic SQL generation for the UpdateCommand is not supported
First let me say I'm fully aware sql server does not short circuit evaluate.
In past I use dynamic sql and datatable to get data from database. Such
I have a dynamic SQL statement I've created in a stored procedure. I need
How do you build and use dynamic sql in a MySQL stored procedure?
I like the flexibility of Dynamic SQL and I like the security + improved
So I was thinking about creating a dynamic sql question, meaning that i want
which method do you prefer for creating dynamic sql queries? formating or streaming? Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.