Hiii I got a error while working with datatables...

The code and Error Are Given below


DataSet ds;
SqlDataAdapter da;
ds=new DataSet();
da=new SqlDataAdapter("Select * from emp",cn);
da.Fill(ds,"emp");
DataTable dt;
DataRow drr;
dt=ds.Tables("emp");

c:\inetpub\wwwroot\CSExs\MoveRec.aspx.cs(109): 'System.Data.DataSet.Tables' denotes a 'property' where a 'method' was expected

Please Help me....

Recommended Answers

All 2 Replies

Why bother with the DataSet if you just want a DataTable then just do this:

SqlDataAdapter da;
da=new SqlDataAdapter("Select * from emp",cn);
DataTable dt;
da.Fill(dt);
DataRow drr;

Why bother with the DataSet if you just want a DataTable then just do this:

SqlDataAdapter da;
da=new SqlDataAdapter("Select * from emp",cn);
DataTable dt;
da.Fill(dt);
DataRow drr;

Thanks a lot Mr.hollystyles

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.