dataset in vb.net

Author Topic
Vasudha Rajguru
Member

Joined: 07 Nov 2005
Country: India
Posts: 2

Posted: 11 Nov 2005 13:24:51

Hi,
I am creating vb.net application in which I have some problem with comparing values in dataset with some textbox entry/system day like(thursday,friday....)
and according to result of that comparison I should perform some other task.
but the problem arises in comparison.
my dataset is having only one column(which is not a primary key & not a reference key to any table)
and n numbar of rows in it.
when I try to compare value of some textbox with all the rows in dataset,it gives me error table does not contain primary key.So,I can't access(can't compare) values which are inside dataset.

The problem is comparing value of dataset which column is not a primary key

In tried some code like

objdataadpter as sqlsdataadapter("query"con)
objdataset=new dataset
objdataadapter.fill(objdataset,"table_name"

1)tried
objdaaset.tables(0).find(textbox1.text)=true/false

2)tried
objdataset.tables("table_name".rows(0).find(ctype(textbox1.text,object)).is null("doc_day" then
do some task

I have also tried using datareader class

Waiting for result

bye
from me

Hi,
I am creating vb.net application in which I have some problem with comparing values in dataset with some textbox entry/system day like(thursday,friday....)
and according to result of that comparison I should perform some other task.
but the problem arises in comparison.
my dataset is having only one column(which is not a primary key & not a reference key to any table)
and n numbar of rows in it.
when I try to compare value of some textbox with all the rows in dataset,it gives me error table does not contain primary key.So,I can't access(can't compare) values which are inside dataset.

The problem is comparing value of dataset which column is not a primary key

In tried some code like

objdataadpter as sqlsdataadapter("query"con)
objdataset=new dataset
objdataadapter.fill(objdataset,"table_name"

1)tried
objdaaset.tables(0).find(textbox1.text)=true/false

2)tried
objdataset.tables("table_name".rows(0).find(ctype(textbox1.text,object)).is null("doc_day" then
do some task

I have also tried using datareader class

Waiting for result

bye
from me

Mark DNZone.com
Zone Administrator

Joined: 09 Aug 2005
Country: Netherlands
Posts: 24

Posted: 14 Nov 2005 09:38:10

I presume you want to compare textually, as you want to compare with a textbox. You could explicitly cast the data in the dataset to a String object, and then compare it with the "equals" function to the text property of the textbox. If you do want to know whether the value is part of the string, then have a look at the indexof functions, which can take strings as well.

I've provided the function names by head, so it might not be completely accurate <img src=../images/dnzone/forum/icon_smile_wink.gif border=0 align=middle>

Cheers,

Mark

--
DNZone.com

I presume you want to compare textually, as you want to compare with a textbox. You could explicitly cast the data in the dataset to a String object, and then compare it with the "equals" function to the text property of the textbox. If you do want to know whether the value is part of the string, then have a look at the indexof functions, which can take strings as well.

I've provided the function names by head, so it might not be completely accurate <img src=../images/dnzone/forum/icon_smile_wink.gif border=0 align=middle>

Cheers,

Mark

--
DNZone.com
chan lemo
Member

Joined: 16 Oct 2008
Country:
Posts: 1

Posted: 16 Oct 2008 09:32:02

take vzrhz6assign the values in variables and then compare it.

want to see more samples ..


vb.net-informations.com/dataset/vb.net-ado.net-dataset-tutorial.htm

lemo.



<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi,
I am creating vb.net application in which I have some problem with comparing values in dataset with some textbox entry/system day like(thursday,friday....)
and according to result of that comparison I should perform some other task.
but the problem arises in comparison.
my dataset is having only one column(which is not a primary key & not a reference key to any table)
and n numbar of rows in it.
when I try to compare value of some textbox with all the rows in dataset,it gives me error table does not contain primary key.So,I can't access(can't compare) values which are inside dataset.

The problem is comparing value of dataset which column is not a primary key

In tried some code like

objdataadpter as sqlsdataadapter("query"con)
objdataset=new dataset
objdataadapter.fill(objdataset,"table_name"

1)tried
objdaaset.tables(0).find(textbox1.text)=true/false

2)tried
objdataset.tables("table_name".rows(0).find(ctype(textbox1.text,object)).is null("doc_day" then
do some task

I have also tried using datareader class

Waiting for result

bye
from me


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

take vzrhz6assign the values in variables and then compare it.

want to see more samples ..


vb.net-informations.com/dataset/vb.net-ado.net-dataset-tutorial.htm

lemo.



<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi,
I am creating vb.net application in which I have some problem with comparing values in dataset with some textbox entry/system day like(thursday,friday....)
and according to result of that comparison I should perform some other task.
but the problem arises in comparison.
my dataset is having only one column(which is not a primary key & not a reference key to any table)
and n numbar of rows in it.
when I try to compare value of some textbox with all the rows in dataset,it gives me error table does not contain primary key.So,I can't access(can't compare) values which are inside dataset.

The problem is comparing value of dataset which column is not a primary key

In tried some code like

objdataadpter as sqlsdataadapter("query"con)
objdataset=new dataset
objdataadapter.fill(objdataset,"table_name"

1)tried
objdaaset.tables(0).find(textbox1.text)=true/false

2)tried
objdataset.tables("table_name".rows(0).find(ctype(textbox1.text,object)).is null("doc_day" then
do some task

I have also tried using datareader class

Waiting for result

bye
from me


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency