473,405 Members | 2,444 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,405 software developers and data experts.

How to populate fields on form from database

I need to populate my textfields from values in database. I also need navigation buttons to scroll through all records, similar to an access form. Below is what I have on the OnLoad event:

Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.  
  4.             SqlConnection conn = new SqlConnection(GetConnectionString());
  5.  
  6.             SqlCommand cmd = new SqlCommand("SELECT * from CriminalHistoryCriteria", conn);
  7.  
  8.             cmd.Connection.Open();           
  9.             cmd.ExecuteReader();
  10.  
  11.             cmd.Connection.Close();
  12.             cmd.Connection.Dispose();
  13.  
  14.         }
Oct 28 '10 #1
1 4407
Frinavale
9,735 Expert Mod 8TB
Please review the following article about how to use a database.

It demonstrates how to loop through data that is retrieved from the database and set it to a TextBox's Text property.

-Frinny
Oct 29 '10 #2

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

Similar topics

2
by: Chand | last post by:
Hello Everyboy I am creating a small scale db with following fields in the table and form for the data entry purpose. Product ID Product Name Manufacturer Location 101 ...
2
by: Mal P | last post by:
Hi there, I'm a J2EE fellow who (as usual) has been thrown in the deep end and have to learn a fair chunk of the .NET platform (VS, ADO, WebForms, C# etc) in roughly two days. I'm doing ok so...
1
by: Jassim Rahma | last post by:
Hi, what is the best way to populate comboBox from database.. the reason I am asking is that i have more than 8 comboBoxes in one form and each should retrieve data from a table and I don't want...
5
by: Richard Rosser | last post by:
Greetings. I know not one word of Javascript and wondered if there was an easy way to pre-populate a form field in a similar manner to populating an eMail 'subject' field? - The following...
13
by: Selesti | last post by:
I have written an Access database that our department uses to store and analyze information on particular jobs. Because our company runs on an enormous SQL DB, I thought it would save some time if...
3
by: RamanS | last post by:
Hi, I am trying to populate a form textbox1 using a sql query. The query takes the "where" parameters from another textbox2 located on the form. Please see the syntax below. When i try to run...
1
by: KMEscherich | last post by:
Using Access '97 Hi there, am wondering if someone can please help me with the following: I have a master table (T_INVESTIGATION) that contains the following fields as well as other fields. ...
3
MattFitzgerald
by: MattFitzgerald | last post by:
My Forms & Tables:- Main form is Frm_LE_List (contains Customer Details) Stored in Tbl_LE_List Which contains subform Frm_VOL_References (Contains Orders known as VOL's) Stored in...
3
omerbutt
by: omerbutt | last post by:
hi there can i use this forum to get help for joomla 1.5 ?.......if yes then i have a question that i made a module named hello world and installed it successfully now i am making a module for a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.