473,385 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reading a single field from table

Hi

I need to run a simple select query like below;

select field1 from mytable where id = 123

and assign the returned value of field1 to a variable. What is an easy way
to do this?

Thanks

Regards
Jan 17 '07 #1
1 907
DbCommand.ExecuteScalar

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:us**************@TK2MSFTNGP02.phx.gbl...
Hi

I need to run a simple select query like below;

select field1 from mytable where id = 123

and assign the returned value of field1 to a variable. What is an easy way
to do this?

Thanks

Regards

Jan 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: vool | last post by:
Hi All Can anyone help with this please. I need a way of putting say 10 to 20 bullet points in one table field in an Access database - say seperate them with a special character, then build a...
3
by: Gary Smith | last post by:
Hi, I've got a field that contains a list of rooms. In most cases, this contains a single ID. However, under some circumstances, the field may contain a list of two IDs which are broken by a...
4
by: Roy | last post by:
This was the code I used which was suggested by you.Can you help me here? The code works till before the recordset,RS2. After that it bombs with a error saying "item not found in this...
6
by: Klint Gore | last post by:
In the docs it says "Plan-reading is an art that deserves an extensive tutorial, which this is not". Is there one? I've gone beyond simple queries (which are performing well) to the more...
1
by: ChrisFrohlich | last post by:
ASP.NET 2.0 with Text DataTypes: I've got a similar question going in the SQL group, but I was wondering if anyone has successfully implemented reading/writing character data from a Text datatype...
1
by: pchadha20 | last post by:
How to single numeric values from a field in a table which has multiple numeric value in a field of a table.And that table contains thousands of records. Suppose we have a table customer having...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
3
by: Bjorn Sagbakken | last post by:
What is the best way to read single field values from a dataset? The dataset is populated with a customer record, showing well in a gridview. But I also want to read the single field values, like...
21
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z...
5
by: Harlequin | last post by:
Hi there, I'm something of a newcomer to MS Access so it's more than likely that my question is extremely elementary. I have a form whose record source is a single table in my database. It's...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.