Retreiving data from database

Closed
bhargava000 Posts 1 Registration date Thursday 29 April 2010 Status Member Last seen 29 April 2010 - 29 Apr 2010 à 06:21
 nithin - 29 Apr 2010 à 08:03
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 :(
Related:

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