943,778 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 5370
  • C# RSS
Dec 15th, 2007
0

retreive data in textbox

Expand Post »
hi
im having problem in retreiving data in text box in C# web form.i have a combobox and a textbox.i have successfully populated combobox with data from SQL table.there are 2 tables namely employee and worker.combobox is populated with employeee data and when i select an employee it shows relevant info. in text box from the worker table.this is the point where imhaving problem.
Kindly help me.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
waterfall is offline Offline
24 posts
since Nov 2007
Dec 16th, 2007
0

Re: retreive data in textbox

Ok use this code
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

onn.Open();
// The command settings
SqlCommand oCommand = new SqlCommand("Select * From Employee",oConn);
SqlDataAdapter oAdapter = new SqlDataAdapter(oCommand);
/* we use here data table rather than a data source because
we want just to bind a field to our textbox*/
DataTable oTable = new DataTable();
//Fill data into the data table
oAdapter.Fill(oTable);
/*We don't need the connection new as we consume data from the on memory
* cached data table so we close the connection*/
oConn.Close();
/* Assuming that we need to bind textBox1 to the FirstName Field of
* the employee table*/
textBox1.DataBindings.Add("Text", oTable, "FirstName");
Reputation Points: 11
Solved Threads: 16
Junior Poster
Jugortha is offline Offline
172 posts
since Oct 2007
Dec 17th, 2007
0

Re: retreive data in textbox

But what to do in C# web forms?Actually im working with web form so kindly help me.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
waterfall is offline Offline
24 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: how to insert image path
Next Thread in C# Forum Timeline: read xml file and display to many text box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC