User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 423,538 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,292 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser: Programming Forums
Views: 1607 | Replies: 2
Reply
Join Date: Nov 2007
Posts: 22
Reputation: waterfall is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
waterfall waterfall is offline Offline
Newbie Poster

Help retreive data in textbox

  #1  
Dec 15th, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 92
Reputation: Jugortha is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 8
Jugortha Jugortha is offline Offline
Junior Poster in Training

Re: retreive data in textbox

  #2  
Dec 16th, 2007
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");
Reply With Quote  
Join Date: Nov 2007
Posts: 22
Reputation: waterfall is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
waterfall waterfall is offline Offline
Newbie Poster

Re: retreive data in textbox

  #3  
Dec 17th, 2007
But what to do in C# web forms?Actually im working with web form so kindly help me.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C# Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the C# Forum

All times are GMT -4. The time now is 5:33 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC