473,396 Members | 2,129 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,396 software developers and data experts.

types and untyped dataset and access the right column

hi i have a couple of questions:
1) what is the difference between type and untyped dataset - i would like t
ouse the typed dataset to take adv of intellisense- but the dataset i have
created seems untyped -
herei s my code -
//create myConn to the db and my Select query and execite
SqlConnection myConn = new SqlConnection("");
SqlCommand mySelectCommand = new SqlCommand("SELECT ContactPassword
ContactUserID FROM TABLE WHERE (ContactUserID = @emailAddress)");
mySelectCommand.Connection = myConn;

// let it know about that paramter
mySelectCommand.Parameters.Add(new SqlParameter("@emailAddress",
SqlDbType.VarChar, 50));

//create a sql data adapter
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
myDataAdapter.SelectCommand = mySelectCommand;

//assign the param to the sql params
myDataAdapter.SelectCommand.Parameters["@emailAddress"].Value =
this.TextBoxEmailaddr.Text.Trim();
myConn.Open();

// create a dataset
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
myConn.Close()

2) how do i access a column field called : contactPassword in my Table

this.lblPassword.Text =
myDataSet.Tables["TABLE_Contact_Info"].Rows[0]["contactPassword"].ToString();

IT IS NOT working please help thx in advance

Nov 16 '05 #1
2 2057
Nabil,

A typed data set is basically a derivation from data set, where the
tables are exposed as properties and the rows have properties representing
the fields. In order to generate one, you will have to go to server
explorer and drag the tables into a dataset. Basically, add a dataset to
your project, and then drag the tables onto it, and you should be able to
use it then.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nabil m" <na***@hagedorn.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
hi i have a couple of questions:
1) what is the difference between type and untyped dataset - i would like
t
ouse the typed dataset to take adv of intellisense- but the dataset i have
created seems untyped -
herei s my code -
//create myConn to the db and my Select query and execite
SqlConnection myConn = new SqlConnection("");
SqlCommand mySelectCommand = new SqlCommand("SELECT ContactPassword
ContactUserID FROM TABLE WHERE (ContactUserID = @emailAddress)");
mySelectCommand.Connection = myConn;

// let it know about that paramter
mySelectCommand.Parameters.Add(new SqlParameter("@emailAddress",
SqlDbType.VarChar, 50));

//create a sql data adapter
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
myDataAdapter.SelectCommand = mySelectCommand;

//assign the param to the sql params
myDataAdapter.SelectCommand.Parameters["@emailAddress"].Value =
this.TextBoxEmailaddr.Text.Trim();
myConn.Open();

// create a dataset
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
myConn.Close()

2) how do i access a column field called : contactPassword in my Table

this.lblPassword.Text =
myDataSet.Tables["TABLE_Contact_Info"].Rows[0]["contactPassword"].ToString();

IT IS NOT working please help thx in advance

Nov 16 '05 #2
Nabil,

A typed data set is basically a derivation from data set, where the
tables are exposed as properties and the rows have properties representing
the fields. In order to generate one, you will have to go to server
explorer and drag the tables into a dataset. Basically, add a dataset to
your project, and then drag the tables onto it, and you should be able to
use it then.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nabil m" <na***@hagedorn.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
hi i have a couple of questions:
1) what is the difference between type and untyped dataset - i would like
t
ouse the typed dataset to take adv of intellisense- but the dataset i have
created seems untyped -
herei s my code -
//create myConn to the db and my Select query and execite
SqlConnection myConn = new SqlConnection("");
SqlCommand mySelectCommand = new SqlCommand("SELECT ContactPassword
ContactUserID FROM TABLE WHERE (ContactUserID = @emailAddress)");
mySelectCommand.Connection = myConn;

// let it know about that paramter
mySelectCommand.Parameters.Add(new SqlParameter("@emailAddress",
SqlDbType.VarChar, 50));

//create a sql data adapter
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
myDataAdapter.SelectCommand = mySelectCommand;

//assign the param to the sql params
myDataAdapter.SelectCommand.Parameters["@emailAddress"].Value =
this.TextBoxEmailaddr.Text.Trim();
myConn.Open();

// create a dataset
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet);
myConn.Close()

2) how do i access a column field called : contactPassword in my Table

this.lblPassword.Text =
myDataSet.Tables["TABLE_Contact_Info"].Rows[0]["contactPassword"].ToString();

IT IS NOT working please help thx in advance

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Erwin Pant via DotNetMonster.com | last post by:
Hi, I'm uploading .dbf and MS Access tables into my DataSet (untyped) and I wanted to know what would be the best way to get the column lengths once the data has been placed in my DataSet. I am...
0
by: nabil m | last post by:
hi i have a couple of questions: 1) what is the difference between type and untyped dataset - i would like t ouse the typed dataset to take adv of intellisense- but the dataset i have created...
1
by: nabil m | last post by:
hi i have a couple of questions: 1) what is the difference between type and untyped dataset - i would like t ouse the typed dataset to take adv of intellisense- but the dataset i have created...
2
by: thomson | last post by:
Hi All, What is the difference between a typed dataset and an untyped datset, Where can be this used actually, I mean in which situation which has to be used, In case anyone has got some...
7
by: Przemo | last post by:
Hi, I wonder about performerce comparision between these two types of DataSets. Are benefits of typed DataSets enought to beat speed of untyped ones? Or it doesn't matter? What do you think? ...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
0
by: vrushalik | last post by:
Hi, i want to know pros and cons of both Typed and Untyped dataset in detail. can we customize untyped dataset? What is benefit of Typed dataset? is there significant difference between...
1
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i have an untyped dataset defined. I defined a Primary key for it as well. In the code-behind how do i manually modify the primary key field as auto seed increment? thanks, rodchar
1
by: zlf | last post by:
Hello As a known issue, WCF does not allow to transfer typed DataSet. So I have to copy all data from typed DataSet to untyped DataSet(same table names, column names and row data). What is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.