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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:10:11+00:00 2026-06-18T05:10:11+00:00

PROBLEM: How can I get the certain autonumber id ? ID DESCRIPTION CLASS 1

  • 0

PROBLEM:

How can I get the certain autonumber id?

ID  DESCRIPTION CLASS 
 1  test1         a 
 2  test2         b
 3  test3         a
 4  test4         a 
 5  test5         b 

id (auto-increment in SQL Server)

Here is the scenario:

I have here 3 columns something like this.

My class is declared using this to get the value of a certain class.

string strclass = string.empty;
strclass = request.querystring["Class"];

How can I get the id of test2?

I would like to use this select statement wherein I will just use the variable.

For example:

string sqltest = "select description from items where class = '" + strID + "' and class = '" strclass "'";

I just really don’t know, how will I get the class id.

  • 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-18T05:10:12+00:00Added an answer on June 18, 2026 at 5:10 am

    Your question really is very confusing. You want the id but your SQL returns the description. Surely your SQL should just be:

    string sqltest = "select id from items where description = @description and class = @class";
    

    Do not use string concatenation to generate SQL strings as that opens you up to SQL injection attacks.

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

Sidebar

Related Questions

edit: Solved - mod_rewrite was the problem I can't get CI to work as
Actually my problem is sometimes i can get the location and sometimes i can't
Having a really aggravating problem using Managed Metadata in SP2010 where I can get
I'm stuck on an aggregation problem that I can't get to the bottom of.
I am stuck in a printf problem. I would appreciate if I can get
I'm new with Django + Ajax. My Problem is I can't get the value
Ok, so this seems like a really silly problem but I can't get my
I can't get around a peculiar problem with SimpleOpenNI for Processing ao I'm asking
got a problem, can't get my head around this jquery and would appreciate your
I have a problem, I can't get the result of my code. When I

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.