TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Scott Stewart
1.6k
189
18k
Getting data from a dataset
Mar 27 2012 6:37 PM
This is very frustrating!
string strAccessCon=@"Provider=Microsoft.Ace.OLEDB.12.0;" +
@"Data Source=C:\Users\Scot\Documents\Landman\NewLandman.accdb";
DataSet thisDataSet=new DataSet();
OleDbConnection thisCon=new OleDbConnection(strAccessCon);
OleDbDataAdapter daTracts =new OleDbDataAdapter();
string thisTract = tractNo.Substring(6);
string strSQL = "Select TractName, TractID, SurveyID, TractDescription FROM tblTracts WHERE TractName='" + @thisTract +"'";
OleDbCommand selectCmd=new OleDbCommand(strSQL, thisCon);
daTracts.SelectCommand=selectCmd;
daTracts.Fill(thisDataSet,"tblTracts");
DataTable myTable = thisDataSet.Tables[0];
if (myTable.Rows.Count>0)
{
int rowCount = myTable.Rows.Count;
tractName= myTable.Rows[0].ToString();
}
So I found out there is one row (as it should be). So where are the values I need? I have tried all sorts of different lines to extract the values from the table. I would rather just get it from the Dataset, but I have not been able to find any documentation on how to do it. MSDN site doesn't help.
I need to know how to access the columns in the row.
Reply
Answers (
1
)
C# Report viewer doesn't refresh on data changes (SOLVED)
Error to Create Team Project From Visual Studio 2008 to TFS 2010