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 8318609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:02:02+00:00 2026-06-08T22:02:02+00:00

doubles quotes dont work so you have to type ‘some value’ to actually do

  • 0

doubles quotes dont work so you have to type ‘some value’ to actually do variable comparisons when doing direct execution of SQL statements.

Problem is that now when I execute the SQL statement from ASP.NET code I dont seem to be getting any readings…I am not even getting errors :S….

I HAVE tried executing the SQL statement on its own, and it does work.

public static string testExi(string localIncidentNum)
        {

            try
            {
                string query = "SELECT TOP 1 UniqueColID From DBNAME WHERE LocalIncidentNum = @localIncidentNum ORDER BY [version] DESC";

                DataTable dt = new DataTable();
                SqlConnection connection = new SqlConnection(connectionStr);

                SqlCommand command = new SqlCommand(query, connection);
                command.Parameters.AddWithValue("@localIncidentNum", localIncidentNum);

                connection.Open();
                SqlDataAdapter adp = new SqlDataAdapter(command);
                adp.Fill(dt);
                connection.Close();
                command.Dispose();
                connection.Dispose();

                if (dt.Rows.Count != 0)
                {
                    string UniqueColID = dt.Rows[0]["UniqueColID"].ToString();
                    return UniqueColID;
                }
                else
                {
                    return null;
                }


                string some = dt.Rows[0]["UniqueColID"].ToString();
                return some;
            }


            catch (Exception err)
            {
                Global.tmpmsg = " Updating follow up was not successful. " + err.ToString();
                return null;
            }


        }

If I hardcode an incident value in the SELECT statement it works but if I hardcode the incident value in .addwithvalue, it doesn’t work.

    command.Parameters.AddWithValue("@localIncidentNum", "12-023696");
  • 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-08T22:02:06+00:00Added an answer on June 8, 2026 at 10:02 pm

    I solved it. The problem was that I (for some reason) needed to put the full path of the table before the table name in sql code when executing it from C sharp file:

    SELECT TOP 2 [DB name].[dbo]. [table name]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have some jsp var foo <c:set var=foo value=foo's bar/> And I have
I have a string, $server['fish_stick'] (disregard double quotes) I don't know how to successfully
I have the following string (the double quotes are part of the string): abc
I have a JSP page retrieving data and when single or double quotes are
I have a text file that have strings enclosed within double-quotes. I want to
I have this where edit_FName & edit_LName represent asp.net textboxes: $.ajax({ type: POST, url:
I have a problem with double quotes in classic ASP. I want to replace
Ok, I have these string prototypes to work with, however, I don't understand what
I was doing some stuff with jQuery parseJSON function. This is the code, which
I have some reasonable (not obfuscated) Perl source files, and I need a tokenizer,

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.