In this Example, I have Create a connecton string and establish a connection between object to database. and Select title from employees table.
string connectionString = "Data Source=.;Initial Catalog=Northwind;Integrated Security=True";
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (NorthwindDataContext context = new NorthwindDataContext(connection))
{
var query = from c in context.employees
select c.Title;
foreach (var title in query)
{
Response.Write(title);
}
}
Author:
Aamir Hasan औथोर:
आमिर हसन أثر
أمير حسن .
2ef11c0f-4ab9-4df4-8590-00031b5e7899|1|5.0
ALL, asp.net, asp.net 4.0
asp.net, linq