473,385 Members | 2,069 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,385 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 2056
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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.