473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading just one cell out of a dataset.


Hello,
How could I read just one cell out of a dataset?

I have a query returing a 3 x 3 table.

a b c
d e f
x y z
I need the value of "f" ([2][2] ) from the table. How could I do this using
C#?

Thanks in advance,

System.Data.Dat aSet onhand(string partno) {

string connectionStrin g = "server=\'sql01 \'; trusted_connect ion=true;
database=\'data 03\'";

System.Data.IDb Connection dbConnection = new
System.Data.Sql Client.SqlConne ction(connectio nString);

string queryString = "SELECT [inmast].[fonhand] FROM [inmast] WHERE
(([inmast].[fpartno] = \'"+partno+"\ ') AND" + " ([inmast].[fcstscode] =
\'A\'))";

System.Data.IDb Command dbCommand = new System.Data.Sql Client.SqlComma nd();

dbCommand.Comma ndText = queryString; dbCommand.Conne ction = dbConnection;

System.Data.IDb DataAdapter dataAdapter = new
System.Data.Sql Client.SqlDataA dapter();

dataAdapter.Sel ectCommand = dbCommand; System.Data.Dat aSet dataSet = new
System.Data.Dat aSet();
dataAdapter.Fil l(dataSet);
return dataSet;
}
Nov 17 '05 #1
0 954

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

Similar topics

4
2830
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the form/grid first opens up and the grid is immediately sorted the TB don't reflect the sorted data of the First row of the grid. Note: Initially the black grid indicator arrow points to the first row. If the user choses another row and then sorts...
4
18282
by: N. Okan Guney | last post by:
Hello, How could I read just one cell out of a dataset? I have a query returing a 3 x 3 table. a b c d e f x y z
1
3540
by: Thanks | last post by:
I have a routine that is called on Page_Init. It retrieves folder records from a database which I display as Link Buttons in a table cell. I set the table cell's bgcolor to a default color (say black for example). I am dynamically creating the LinkButton controls and adding them into the table cell and I've also hooked up an event handler for each LinkButton's Click event. This all works fine. Now in the Link Button's Click event...
5
1326
by: WebBuilder451 | last post by:
is there ant place where i can learn the basics of reading an rss feed and enumerating through the values? just want to start at the bottom, no frills. thanks -- thanks (as always) some day i''m gona pay this forum back for all the help i''m getting kes
12
27218
by: DaveS | last post by:
Hi! Just a quick question... I need to import user data from an Excel spreadsheet. In VB6, I used strData = xlWksht.Range("$A$1) & "" to import a cell with string data in it. That worked just fine.
4
10693
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to make sure entry is valid? Thanks, Rog
0
1296
by: theintrepidfox | last post by:
Dear Group I really need your help on this issue. I've a datagrid which source is a dataview based on a dataset. The columns of the grid are datagridtextbox columns created like the following example: Dim Column1 As New DataGridTextBoxColumn With Column1
5
8935
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column headers). I used ODBC in my VB.NET program to read that spreadsheet into a dataset, to make it easy to manipulate. The code I use to read it is as the bottom of this posting.
2
5614
by: rwiegel | last post by:
I'm trying to read rows from an Excel file and display them in an ASP.NET DataGridview. I am using C# for the code file. I am using OleDb to read from the Excel file. The columns that contain text load into the grid fine, but the columns that contain just numbers don't show up at all. I tried converting the text of the cells to an integer first, but I get an error for converting from a type DBNull. Anybody who has any help at all, I...
1
4444
by: Drake250 | last post by:
I've been trying to play around with reading in an XML file that would look something like this into a 2D array with no luck: <?xml version="1.0" ?> <map index="0" name="Test" cellsx="2" cellsy="2" cellwidth="16" cellheight="16"> <layers> <layer index="0" name="TopLayer" visible="1"> <cell x="0" y="0" img="24" /> <cell x="1" y="0" img="56" /> <cell x="0" y="1" img="23" /> <cell x="1" y="1" img="76" /> </layer>
0
8397
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6167
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.