Display the user data in Textbox

I have a table in the database. It has three fields EmpId, EmpName, EmpSalary. In the Employee.aspx page, I have three lables and three textboxes. Once I login in to the system the corresponding details should be displayed in the textboxes. Please help me in this regard.


11/28/2007 1:50:54 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

11 Replies

Similar Articles

[PageSpeed] 41

Add a where clause in SELECT query to select record specifig to the user.

   string queryString = "SELECT * FROM TableName";
   using (SqlConnection connection = new SqlConnection(connectionString)
        SqlCommand command = new SqlCommand(queryString, connection);
        SqlDataReader reader = command.ExecuteReader();
        if (reader.HasRows)
            while (reader.Read())
               TextBox1.Text = Convert.ToString(reader["EmpID"]);
               TextBox2.Text = Convert.ToString(reader["EmpName"]);
catch (SystemException ex)
Let Me Google That For You!
11/28/2007 2:18:16 PM


you can use the detailsView  please follow this tutorial , navigate to VB Master-Details (Separate Pages)


Run Sample View Source



Anas Ghanem.

Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums (like duplicate ,Off-topic,offensive,or any post that violates the website "TERMS OF USE"). -- Thanks!

11/28/2007 2:36:37 PM

Can you please provide me the code in vb.net please.

11/28/2007 2:38:14 PM

coming soon...

Let Me Google That For You!
11/28/2007 2:45:15 PM

I am experiencing an syntax error near import

11/28/2007 2:48:01 PM


    Dim queryString As String = "SELECT * FROM TableName"
    Using connection As New SqlConnection(connectionString)
    Dim command As SqlCommand = New SqlCommand(queryString, connection)
    Dim reader As SqlDataReader = command.ExecuteReader
    If reader.HasRows Then
        While reader.Read
            TextBox1.Text = Convert.ToString(reader("EmpID"))
            TextBox2.Text = Convert.ToString(reader("EmpName"))
        End While
    End IfEnd Using
Catch ex As SystemException
End Try

Let Me Google That For You!
11/28/2007 2:48:59 PM

I was using an online code converter and they suck sometimes. After posting, I realized that it changed "using" keyword to Imports, which was not right in this case. I posted new code.

Let Me Google That For You!
11/28/2007 2:53:11 PM

Thank you very much. It is working. How to write the code for ID. I mean if EmpID=1 then display EmpId details i.e depending on the EmpId.

11/28/2007 2:54:27 PM

 You have to modify the SQL query. Add a WHERE clause in the query like: 

SELECT EmpID, EmpName, EmpSalary
FROM TableName

In place of ID, use parameters to prevent SQL attacks. Look online for some articles. Heres one:


Let Me Google That For You!
11/28/2007 2:59:56 PM

Thank you very much.

11/28/2007 3:07:26 PM

You are welcome.

Let Me Google That For You!
11/28/2007 3:08:24 PM

Similar Artilces:

hei guys, i need help on my application, i'm using C#.NET as front-ed and SQL as back-end, aside from a datagrid, i want to display my data using textboxes and not a datagrid, i can do it using Visual Basic 6 but since i'm a newbee at C#.NET i don't know how to do it, specially the codes, can anyone help me with it? thank you in advance! If you are doing windows development, i would suggest using 'DataForm wizard' (Use Solution Explorer-->Rightclick project-->Add new Item-->New DataForm). It will guide you through steps. If you are doing web apps. Use quickstart to learn them. h...

How can display a web form to the user whilst loading data from distributed systems in the background?
Hi, I've been fiddling around with ASP.NET AJAX trying to work out how I can solve the following problem... I am trying to translate a WinForms custom control to an ASP.NET custom control. The control is like a custom data binder which loads some data from a SQL database and also uses a background worker thread to load data from a number of third party sources. This data is then bound controls on a hosting form. The user sees the data from SQL straight away when the form loads as this is usually pretty snappy, then the third party data appears when the background worker finishes processing...

Pass data from Web User Control to Web Form
I have a Web Form that contains a Web User Control. The WUC displays dynamic content. I want to change the TITLE property of the Web Form, based on the contents of the WUC. For example, if the WUC displays information about Horses, I want to change the page title to "HORSES" by passing the string to the parent Web Form. I have tried playing with parameters and such, but I can't remember how I did this in the past. PLEASE HELP!~o0 Spin-Monkey Oo~ The best way to do this is by creating a public property on your web user control and accessing that from your web form. Check ...

Web form that displays data and post data to a database
Hi,  I have a web form that needs to Get the userID and then display data from datasource 1 -  name, Phone, Address etc. of the user Then on the same form the user needs to submit additional information and click submit.  On click submit, I would like to capture all the info about the user from datasource1 - i.e name, phone, Address etc along wiht the additional info submitted by the user and insert into a table. Currently the way I am doing is: when the user enters their UserID, I use a formview to display the user data. When the user clicks submit on th...

validate Textbox in Web User Control from web form?
ASP.NET 2.0 I have a web user control that contains a textbox.  I need to add some validation (like requiredfieldvalidator, comparevalidator, etc). I would normally add the validator to my web user control by placing the validator next to my textbox.  However, I need the validation message somewhere else on my web form, not near the user control. So how would I associate a validation control on my web form with the text box inside my web user control?  Can this be done; any alternatives out there? Thanks!   The error message should occur wherever you place the vali...

user control data entry form, use same codebehind as web form?
Hi All, I have a quesiton about the approach I'm taking. I have a series of report forms which I have been in the process of consolidating to a single, generic page and subs/functions in a single code-behind. All the reports can use the same set of data entry elements (a dropdown, a radio list, and a textbox). I'm trying to convert these elements to a user control. However, this user control seems to need to inherit differently than the rest of the code-behind. I've been using a single class in the code behind. Is it feasible to separate out the data entry? the code behind im...

Filling a textbox on a parent web user control from a child web form
Hi, I currently have a web user control (pf_imageselector.ascx) which is dynamically created (any number of times) on a parent web user control (pf_fillitems.ascx) which in turn has been loaded into a webform (default.aspx). On the user control is a text box called txbSelectedImage and a button. On click of the button run's this code: function OpenChild() { var strImageFile; var WinSettings = "height=580,width=630,status=yes,toolbar=no,menubar=no,location=no"; window.open("pf_stockimage.aspx", null, WinSettings); } Which obviously open a ch...

Problem in accessing web form data in user controls when create user control dynamically
HI. I have a problem using web user control. I designed a user control named NewsForm. This user control contains some web form elements like <asp:textbox>. When I add it in an .ASPX page, all things may be true. I can know which user filles in textbox (for example and other controls) <%@ Register TagPrefix="uc1" TagName="NewsForm" Src="NewsForm.ascx" %> and <UC1:NewsForm id="newsForm" runat="server"></UC1:NewsForm> But when i create it in code behined dynamically, however user control has web form controls but their value are blank for example //aspx co...

Strange output in web form after web form is displayed.
   I have been using a web user control for over a week now with no problems. I am now getting strange output in my web form after my controls display on the page. Below is the strange output. Can anyone tell me what is wrong here? Note I did not include it all because it is quite large.   Request Details Session Id: l5b5vkazucfatba4oliaw1vi Request Type: POST Time of Request: 9/10/2007 4:59:59 PM Status Code: 200 Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8) Trace Information Category Message From First(s) F...

Displaying Data From a web Form
I have created a web form with 5 different panels, each panel has a number of controls - text boxes, check boxes etc. I would like to know How I can display all the information typed into the different controls in a label. An web site or example would be great oh and im using VB not C#. uh... Am I missing something here? myLabel.text = somecontrol1.text & somecontrol2.text & control3.text ... Ask and it will be given to you; seek and you will find; knock and the door will be opened to you. Luke 11:9...

Submitting data from a know web form to unknown web form
hi i m making a software in which i will submitt some data from a web page that will go to a web form of which contrlos are unknown to me only i know the name and how many controls in that form it means i can see the form only. how can i do this please help me soon with code plz its very argent.i m doin this wit the help of foxtrot.xray.WebRobot but its giving me error that this dll file is already exists in The file ('C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\_foxtrot.xray.WebRobot.dll' already exists).i don know what will do so please help me soon please thanks praveen We ca...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

synchronizing chunk of data of one web form for another web form
I'm making a web application. In one web form; i'm taking inputs from user. Now; there is some info given by user in this page which is needed for web form which is going to be displayed next. i want to display that info automatically on that web form so that user doesn't have to re-input that info in this next web form. Info from first page would be inserted into database when user clicks on the submit button. then that next web form would be displayed. and the chunk of info from previous page should be displayed there!!! how can i do this?? cany anybody help?? nobody can help me!! I...

Persisting data in a web user control, which contains a list of other web user controls.
 Hi All, I have a control I've created, which can have a number of child controls - also user controls - stored as an ArrayList, which can be added wither a design time or programmatically.My problem is when I add to the list programmatically, it doesn't persist them. So if I add 3 child controls in step 1 of a wizard, with the aim that those three will be visible inside the parent in step 3, what happens is that the parent has no child controls and the item count is 0.Can anyone help? Thanks in advance.Code:Parent Control Markup: <%@ Control Language="C#" Auto...

Web resources about - Display the user data in Textbox - asp.net.web-forms

Samples of display typefaces - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Report: Apple to begin shifting iPhone displays from LCD to OLED in 2018
... benefits from deeper blacks and greater energy efficiency thanks to OLED technology Apple is expected to begin shifting iPhones from LCD displays ...

Southwest flight headed to LAX diverted after 3 passengers display suspicious behavior
... flight headed to the Los Angeles International Airport from Indianapolis was diverted to Kansas City Sunday after three passengers displayed ...

Sidefari lets iPad owners display two Safari Web pages side-by-side
... what a lot of iPad Air 2, iPad mini 4, and iPad Pro owners have been asking for: it allows users to load up two Safari Web pages, and to display ...

2015 Los Angeles Auto Show tech: Augmented reality manuals and retina-display maps
Jonathan Gitlin A view out over part of the cavernous South Hall. 20 more images in gallery LOS ANGELES—The LA Auto Show got underway this ...

Plastic, please: Food displays almost good enough to eat - Videos - CBS News
Across Japan, realistic-looking food displays are used by restaurants to demonstrate portion size and to lure customers. The fake food is becoming ...

HOA Decides Not To Sue Man Over Controversial Christmas Display With Hundreds Of Lights, Live Camel
... Washington man who takes a next-level approach to the holiday: his local homeowner’s association has decided it won’t sue him over his display, ...

Apple will embrace OLED displays starting with iPhone 8
Apple will adopt OLED displays for its handsets beginning with the iPhone 8 in 2018, according to a new report coming out of Japan. OLED displays ...

Presidential candidates display faith, fire
DesMoinesRegister.com Presidential candidates display faith, fire DesMoinesRegister.com The auditorium was hushed and still as Iowa Christian ...

2015 large area display shipment declines offset by increase in shipment area, says IHS
Large-area display shipments are forecast to fall 5% on year, reaching 682 million units in 2015. This decline in unit shipments will be offset ...

Resources last updated: 11/27/2015 9:54:37 AM