473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Data Access using SqlDataAdapter

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
2 1659
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
5
by: Alex | last post by:
Hi, I have an aspx file that creates a custom class object and calls a method which should return a DataSet. It throws a: Description: The application attempted to perform an operation not...
0
by: Tim Barnes | last post by:
I am going through a revision of my product where I am trying to abstract out the data access layer, where I have traditionally just dragged/dropped data adapters and generated datasets using...
5
by: Stephanie_Stowe | last post by:
Hi. I am trying to get used to AS.NET. I have been doing ASP classic for years, and am now in a position to do ASP.NET. I am in the stumbling around until I get my bearings phase. I hope you will...
10
by: Trevor | last post by:
Hey, I am trying to do this tutorial on the microsoft site : http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndotnet/html/usingadonet.asp I can get everything to work up to...
10
by: Doug Bell | last post by:
Hi, I have an application that has a "Data Access Class" and "User Interface Class". It is for receiving Purchase Order data from one system and pushing processed transactions to another...
13
by: MikeS | last post by:
I am relatively new to VB.Net so bear with me. I can add an OleDBDataAdapter using the Jet 4.0 with no problem (although I'm having problems getting Date and Time formats to carry over to the...
1
by: languy | last post by:
Hi there I'm having a problem when using the SqlDataAdapter. When calling the Update(DataSet, string) method I get the following error message "String or binary data would be truncated". The...
4
by: George | last post by:
Hi all, I am having trouble with updating my data in an Access database. here is my code: Imports System.Data.OleDb Dim AppPath As String = Mid(Application.ExecutablePath, 1,...
12
by: joaotsetsemoita | last post by:
Hello everyone, im completly new to vb.net and I was assigned to do a simple piece of software that just had to select from um db in a MS access data base and insert into a SQL server Database....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.