Retreiving data from database

Closed
bhargava000 Posts 1 Registration date Thursday April 29, 2010 Status Member Last seen April 29, 2010 - Apr 29, 2010 at 06:21 AM
 nithin - Apr 29, 2010 at 08:03 AM
hi i am bhargava, i am doing a project using asp .net (c#), sql server.

when i enter text in a textbox and then click submit button, data should be retrieved from database in relevant textboxes.

please help me in solving my problem :(

1 response

Hi Bhargava here is the solution...
using System.data.sqlclient;
button1_click
1.use sqlconnection to connect to dtabase with appropriate connection strings
2.sqlcommand com=new sqlcommand("select * from emp where empid=@empid",con);
3.com.parameters.add("@empid",textbox1.text);
4.connection.open();
5.sqldatareader rdr=com.executereader();
6.while(rdr.read())
{
messagebox.show(rdr["name"].tostring());
}
7.here i used message box instead u use whatever u want.
if u want sample c#.net projects mail me to nithin8702@gmail.com
0