retrieving the data from database using query string

Posted by Kusuma under ASP.NET on 1/25/2013 | Points: 10 | Views : 2338 | Status : [Member] | Replies : 1
I have stored an employee and salary details in the database tables. Now I have to retrieve all the details from database by using query string
But I'm not sure is it possible to get them using query string concept.

And I have taken the common column empid in both the tables

Please help in this




Responses

Posted by: Durgammahesh22 on: 1/30/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Below is a sample code to fetch information from your employee and salary tables


public SqlDataReader GetData()
{
SqlConnection sqlConnection = new SqlConnection("Your Connection String");
SqlCommand sqlCommand = new SqlCommand ("Select e.empid, e.empname, s.salary from employee e join salary s on e.empid=s.empid ", sqlConnection);
sqlConnection .Open()
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
sqlConnection.Close();
return sqlDataReader;
}



Thanks,
Mahesh

Thanks,
Mahesh

Kusuma, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response