Click here to Skip to main content
15,925,528 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi. i need small c# project. when i enter name into txtbox1, txtbox2 must dislpay her age. im using sql and c#. please help me. thanks
Posted
Comments
Chuck N0rris 24-Feb-12 11:32am    
Google for "C# ADO.NET Sql server Insert Update"
R. Giskard Reventlov 24-Feb-12 11:34am    
No homework!
Abhinav S 24-Feb-12 11:38am    
Try something and post issues you run into here.

Start Visual Studio, click File, New Project and then get started writing your classes and data access and stored procedures. When you have something specific, please come back and ask so we can help.
 
Share this answer
 
I am assuming,

  • You want user to enter their name in the TextBox1
  • Based on the name from the TextBox1, you will retrieve Age information from the Database.
  • Show the retrieved Age information on the TextBox2.

If the assumption is right, you might need to read through the following articles,

The C# Station ADO.NET Tutorial[^]
Beginners guide to accessing SQL Server through C#[^]
Displaying Data in a Windows Form Using a Parameterized Query[^]
and
More Information[^]

Hope it helps :)
 
Share this answer
 
Comments
Amal anjula 25-Feb-12 1:51am    
oke.but no idea about bind data to textboxes.
im try in this code.but not work.pls help

try { con1.Open(); // string uname = unamecmbx.Text; // string pword = pwordbx.Text; // SqlCommand command = new SqlCommand("SELECT * FROM [info] WHERE uname='" + txtsrch.Text + "'", con1); SqlDataAdapter ad = new SqlDataAdapter("select * from info where uname like '%" + txtsrch.Text + "%'", con1); SqlCommandBuilder cb = new SqlCommandBuilder(ad); ds.Clear(); ad.Fill(ds);

dataGridView1.DataSource = ds.Tables[0]; if (textBox1.Text == "" || ds.Tables[0].Rows.Count == 0) { dataGridView1.Visible = false; } else { dataGridView1.Visible = true; con1.Close(); }

textBox2.DataBindings.Add("Text", ds, "info.age"); // textBox2.Text = ds.Tables[0].ToString;

} catch (Exception ex) {

MessageBox.Show(ex.Message); con1.Close(); }

finally { con1.Close(); }
then i see this erro msg. but datagrid fill relevan table information.
'child list for field info cannot be create'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900