By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,221 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,221 IT Pros & Developers. It's quick & easy.

Data Access using SqlDataAdapter

P: n/a
In the below listed code, instead of using GetValue(2), is there any way to
retrieve fields by calling the field name itself? (for example
GetValue("str_mail_from") ?????)

================================================== ======myda = new
SqlDataAdapter ("SELECT lng_id,lng_clientid,str_mail_from FROM
web_tbl_emails", mycn);

ds = new DataSet();
myda.Fill (ds,"Table");

foreach(DataRow row in ds.Tables [0].Rows )
{
string test= row.ItemArray.GetValue(2)
}
================================================== ======
Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sure.

row[<ColumnName].ToString();

Yosh

"rkbnair" <rk*****@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
In the below listed code, instead of using GetValue(2), is there any way
to
retrieve fields by calling the field name itself? (for example
GetValue("str_mail_from") ?????)

================================================== ======myda = new
SqlDataAdapter ("SELECT lng_id,lng_clientid,str_mail_from FROM
web_tbl_emails", mycn);

ds = new DataSet();
myda.Fill (ds,"Table");

foreach(DataRow row in ds.Tables [0].Rows )
{
string test= row.ItemArray.GetValue(2)
}
================================================== ======

Nov 22 '05 #2

P: n/a
Sure.

row[<ColumnName].ToString();

Yosh

"rkbnair" <rk*****@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
In the below listed code, instead of using GetValue(2), is there any way
to
retrieve fields by calling the field name itself? (for example
GetValue("str_mail_from") ?????)

================================================== ======myda = new
SqlDataAdapter ("SELECT lng_id,lng_clientid,str_mail_from FROM
web_tbl_emails", mycn);

ds = new DataSet();
myda.Fill (ds,"Table");

foreach(DataRow row in ds.Tables [0].Rows )
{
string test= row.ItemArray.GetValue(2)
}
================================================== ======

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.