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

  • Home
  • SEARCH
  • 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 8878511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:43:45+00:00 2026-06-14T19:43:45+00:00

I have the following query : public static DataTable GetTasks(int empNum) { StringBuilder cmdTxt

  • 0

I have the following query :

 public static DataTable GetTasks(int empNum)
        {
                StringBuilder cmdTxt = new StringBuilder();
                Dictionary<string, string> paramList = new Dictionary<string, string>();
                cmdTxt.Append(" SELECT DISTINCT a.task_code, a.task_name ");
                cmdTxt.Append(" FROM rr2_task a, rr2_task_state b, rr2state_user c ");
                cmdTxt.Append(" WHERE a.task_code= b.task_code ");
                cmdTxt.Append(" AND b.state_code= c.state_code ");
                cmdTxt.Append(" AND c.emp_num = ? ");
                cmdTxt.Append(" AND b.new_flag= 1 ");
                cmdTxt.Append(" UNION SELECT DISTINCT a.task_code, a.task_name FROM rr2_task a , rr2_candidate b ");
                cmdTxt.Append(" WHERE empnum_candidate = ? ");
                cmdTxt.Append(" AND a.task_code = b.task_code ");
                cmdTxt.Append(" UNION SELECT DISTINCT a.task_code, a.task_name FROM rr2_task a, rr2_taskstate b, rr2_stategroup c ");
                cmdTxt.Append(" WHERE a.task_code= b.task_code ");
                cmdTxt.Append(" AND b.state_code= c.state_code ");
                cmdTxt.Append(" AND ((( c.group_type = 1 ) AND ( c.group_code = (SELECT x.degree_code FROM kk2_degree_infor x WHERE x.emp_num = ? ");
                cmdTxt.Append(" AND x.degree_date = ( SELECT MAX(xx.degree_date) FROM kk2_degree_infor xx WHERE xx.emp_num = x.emp_num )))) ");
                cmdTxt.Append(" OR (( c.group_type = 2 ) AND ( c.group_code =  ( SELECT y.title_code FROM hetjob y WHERE y.emp_num = ? ");
                cmdTxt.Append(" AND y.title_date = ( SELECT MAX(yy.title_date) FROM hetjob yy WHERE yy.emp_num = y.emp_num ))))) ");

Now should I add four parameters with different names although it’s actually a one param with the same value ? empNum

  • 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-06-14T19:43:46+00:00Added an answer on June 14, 2026 at 7:43 pm

    Well currently you’re using positional parameters (?) rather than named parameters (@empnum). You haven’t told us what database you’re using, but I’d expect that if you can use named parameters, you could use the same name everywhere and just add a single value.

    With positional parameters, you would have to provide a value for each placeholder, as there’s no way of tying separate ones together.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following method: public static T ExecuteScalar<T>( string query, SqlConnection connection, params
I have the following Webservice and SQL-Query: public class DIENSTLEISTUNG { public string DienstleistungName
I have the following LINQ to SQL insert code: public static int InsertFileToQueue(FileInfo file)
I have a method requiring the following: public static List<ParetoElement> ParetoBuildBySum(List<KeyValuePair<string, double>> inputData) I
I have following query which takes almost 1 minute to execute. public static Func<Entities,
I have the following piece of code public static void main(String[] args) { ArrayList<Integer>
I do have the following Doctrine query. My database is a MySQL. public static
I have the following program: public class RegexQueryExample { public static String[] terms =
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I have a Database class which contanins the follwing methods: public bool ExecuteUDIQuery(string query)

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.