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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:51:19+00:00 2026-05-23T15:51:19+00:00

As title really. I want to object just one specific value from a colum

  • 0

As title really.

I want to object just one specific value from a colum on one row of a SQL database.

The PHP code I would use would be:

$result = mysql_query("SELECT price FROM delivery WHERE id='$id'");
echo mysql_result($result,0);

That would get me the price from what ever autoinc id I choose.

As I’m new to C# its quite tricky to get my head around as there seems to be many different methods to obtain the same results.

Any help would be appreciated, thanks!

EDIT

I’m using System.Data.SqlClient as, so far, its done me proud.

  • 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-23T15:51:19+00:00Added an answer on May 23, 2026 at 3:51 pm

    If data type of PRICE column you want to retrieve is a scalar value and you’ll get only one record then I assume the most efficient way would be ExecuteScalar() method. Here’s a little sample code:

    string conString="Data Source=local;Initial Catalog=...."
    SQLConnection con=new SQLConnection(conString);
    SQLCommand cmd=new SQLCOmmand("SELECT price FROM delivery WHERE =@ID",con)
    cmd.Parameters.Add("@ID", SqlDbType.Int).Value=125//Off course it just a sample value
    con.Open();
    float price=(decimal)cmd.ExecuteScalar();
    
    ......
    con.Close();//don't forget
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title really, I'm in one part of my code and I would
Pretty much what the title says really. We have some code that is .NET
As per the title. I don't really want to list all the other members
This days I'm refactoring code and one of the things I want to improve
I want to use oembed to get the embed code from youtube links with
i want to use an List to store the title, path,... from Documents. I
the question's in the title really. I have an online form where, after a
As the title says really. Does the virtual keyword cause a performance hit?
The title may not really explain what I'm really trying to get at, couldn't
library(ggplot2) my_title = This is a really long title of a plot that 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.