954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

DataTable

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....

sravankolla
Newbie Poster
24 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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;
hollystyles
Veteran Poster
1,182 posts since Feb 2005
Reputation Points: 262
Solved Threads: 68
 

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

sravankolla
Newbie Poster
24 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You