0

Hey all

I have a mdb file. I need to use this file as a datasource to display in the gridview.
Can anyone suggest me how to use a LINQ to add to that gridview.
here the purpose of gridview is simply to display some rows.......


Regards,
Prasanth.

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by prasanthsagar
0

define DataContext with connection string , write a queyr and bind result with gridview like below :

DataContext dc = new DataContext("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Microsoft Access Database\\Microsoft Data Access\\test1.mdb");

Var data = from t in dc.your table name
           Select t;
Gridview1.DataSource = data;
Gridview1.DataBind();

Hey all

I have a mdb file. I need to use this file as a datasource to display in the gridview.
Can anyone suggest me how to use a LINQ to add to that gridview.
here the purpose of gridview is simply to display some rows.......


Regards,
Prasanth.

0

Hey Rohand,
thanks for ur reply..
can u send me the code in C# pls...

regards,
Prasanth.


define DataContext with connection string , write a queyr and bind result with gridview like below :

DataContext dc = new DataContext("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Microsoft Access Database\\Microsoft Data Access\\test1.mdb");

Var data = from t in dc.your table name
           Select t;
Gridview1.DataSource = data;
Gridview1.DataBind();

Edited by prasanthsagar: n/a

0

always welcome... this is the C# code.. you can use it..

Hey Rohand,
thanks for ur reply..
can u send me the code in C# pls...

regards,
Prasanth.

0

To store the data in linq using this syntex

var database =
        from colomn in tables
        where condition
        select condition;

then
Bind the data using Linq Data Source.

protected void Page_Load(object sender, EventArgs e)
   	{
        GridView1.Visible = true;
        if (!IsPostBack)
        {
            GridView1.DataSource = LinqDataSource1;
            GridView1.DataBind();
        }
    	}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.