473,385 Members | 1,356 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.

C# filling a textbox with data from dataset

1
Hi all,

Sry for the noobish question, i have just starting to learn C#..

Now I have a dataset who returns just one single record with 3 columns in it.
Now I want to bind the item from the first column to a textbox, the second item to another textbox and so on.
this is what I have:
Expand|Select|Wrap|Line Numbers
  1. faqBLL _localFaqBLL;
  2.             try
  3.             {
  4.                 int id = ListBoxFaqOverzicht.SelectedIndex;
  5.                 _localFaqBLL = new faqBLL();
  6.                DataSet myDS = _localFaqBLL.ReadFaqDetailBLL ();
  7.                TextBoxVraag.Text = myDS.Tables[0].Rows[0].ItemArray[0].ToString ;
  8.             }
I can't find the error in this..
Can someone help pls.

Thx in advance.
Pit
Nov 22 '07 #1
1 4344
dip_developer
648 Expert 512MB
Hi all,

Sry for the noobish question, i have just starting to learn C#..

Now I have a dataset who returns just one single record with 3 columns in it.
Now I want to bind the item from the first column to a textbox, the second item to another textbox and so on.
this is what I have:
Expand|Select|Wrap|Line Numbers
  1. faqBLL _localFaqBLL;
  2. try
  3. {
  4. int id = ListBoxFaqOverzicht.SelectedIndex;
  5. _localFaqBLL = new faqBLL();
  6. DataSet myDS = _localFaqBLL.ReadFaqDetailBLL ();
  7. TextBoxVraag.Text = myDS.Tables[0].Rows[0].ItemArray[0].ToString ;
  8. }
I can't find the error in this..
Can someone help pls.

Thx in advance.
Pit
you better use...........

Expand|Select|Wrap|Line Numbers
  1.  
  2. TextBoxVraag.Text =  myDS.Tables[0].Rows[0].ItemArray.GetValue(0).ToString();
  3.  
Nov 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Michael Jones | last post by:
Ok.......... I'm trying to fill a parameterized table onto a Dataset via a sqlDataAdapter. It works fine if I fill the Dataset with all the column fields. What I want to do though is to only fill...
6
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
2
by: Alpha | last post by:
Hi, I have a window based program. One of the form has several textboxes and a datagrid. The textboxes are bind to the same dataset table as the datagrid and the text changes to reflect different...
4
by: John Rose | last post by:
I have one databound TextBox on a page with one button. The TextBox loads the correct SQL record data but typing a new string into the Textbox fails to change the DataSet. Any ideas? There must...
3
by: crjunk | last post by:
I have a 3 table in my DataSet that I'm filling with data. After I've filled these 3 tables, I'm then trying to run a query that will fill a 4th table in the DataSet with data from the three...
14
by: Elena | last post by:
I am trying to fill a DataSet using the code at the bottom of this message. At the Fill line, I get an error: An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in...
6
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the...
0
by: Derek Vincent | last post by:
Why am I having problems filling my dataset when I select fields of type varchar(350) from interbase? I can fill the dataset when I select every other field in the table but I receive and error...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.