473,386 Members | 1,758 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.

Question on finding records in a ado.net vb dataset

Could someone please tell me how or if the following is possible. I
have created a small test database and have opened one connection, one
DataAdapter, and one Dataset for it in my vb.net (ado.net) program. I
am able to Navigate through the dataset ie: MoveNext, MoveFirst,
MovePrev, MoveLast by just keeping track of my record position. I can
Add,Delete,Update Records etc by using the CommandBuilder

ie: Dim cb As New OleDb.OleDbCommandBuilder(daUsers)
Now I would Like to add a search feature using two non primary key
fields. I have been able to search for a specific record using the
dataview.find() method but from everything I could find this will only
work on one specified field. From what I have found on the web first
you sort the dataview.sort("LastName") then call the find method
dataview.find("smith"), this works for a single field only. The
problem I am having is I would like to be able to sort by multiple
fields ie: dataview.find("smith","bob") Is there a way to do that?
I have read that the dataview does not require the sort field/fields to
be a primary key field like the datarow.find requires, but I still have
not found a way to do it.
Also, back in the day's of VB version 6, I was able to use sql to
accomplish what I'm now trying to do on one recordset. ie: "SELECT *
FROM Address WHERE FirstName = "Bob" AND LastName = "Smith". You were
able to execute all kinds of query's on the same recordset. Is there
a way to do this on a vb.net dataset.

Thanks

Dave LaPorte.

Jan 19 '06 #1
3 5295
Dave,

Take the other overloaded version from the dataview.find (with the object
array)

http://msdn.microsoft.com/library/de...findtopic2.asp

I hope this helps,

Cor
Jan 20 '06 #2
If you want to search the DataSet, the below should work;

myDataSet.Tables("myTableName").Select("Lastname = 'whateverlastname' AND
FirstName = 'whateverfirstname'")
--
Dennis in Houston
"Newbie" wrote:
Could someone please tell me how or if the following is possible. I
have created a small test database and have opened one connection, one
DataAdapter, and one Dataset for it in my vb.net (ado.net) program. I
am able to Navigate through the dataset ie: MoveNext, MoveFirst,
MovePrev, MoveLast by just keeping track of my record position. I can
Add,Delete,Update Records etc by using the CommandBuilder

ie: Dim cb As New OleDb.OleDbCommandBuilder(daUsers)
Now I would Like to add a search feature using two non primary key
fields. I have been able to search for a specific record using the
dataview.find() method but from everything I could find this will only
work on one specified field. From what I have found on the web first
you sort the dataview.sort("LastName") then call the find method
dataview.find("smith"), this works for a single field only. The
problem I am having is I would like to be able to sort by multiple
fields ie: dataview.find("smith","bob") Is there a way to do that?
I have read that the dataview does not require the sort field/fields to
be a primary key field like the datarow.find requires, but I still have
not found a way to do it.
Also, back in the day's of VB version 6, I was able to use sql to
accomplish what I'm now trying to do on one recordset. ie: "SELECT *
FROM Address WHERE FirstName = "Bob" AND LastName = "Smith". You were
able to execute all kinds of query's on the same recordset. Is there
a way to do this on a vb.net dataset.

Thanks

Dave LaPorte.

Jan 21 '06 #3
'Use the dataview....

' then you can use the find and rowfilter properties .
** dim dataview1 as dataview

'** dataview1 = New DataView(dataset1.Tables(0))

' ** dataview1.RowFilter = "Lastname='Myname'"

Fivel.

Dennis wrote:
If you want to search the DataSet, the below should work;

myDataSet.Tables("myTableName").Select("Lastnam e = 'whateverlastname' AND
FirstName = 'whateverfirstname'")
Could someone please tell me how or if the following is possible. I
have created a small test database and have opened one connection, one

[quoted text clipped - 25 lines]

Dave LaPorte.


--
Message posted via http://www.dotnetmonster.com
Jan 22 '06 #4

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

Similar topics

8
by: glenn | last post by:
If I setup a connection and the appropriate items in C# to link a queried dataset that comes back with 100,000 results to a grid component on a windows form, does that mean that my program just...
2
by: Bill Yeager | last post by:
I have a grid that I databind with a strongly typed dataset which contains thousands of records retrieved from a database. After the dataset is retrieved from the database, I place it in...
5
by: Ale K. | last post by:
Hi, i'm designing my application that has a DLL that controls the Data Layer, and another that Controls the Bussines Layer, at some point my Bussines Layer need to Get an object ( Let's say a...
1
by: Agnes | last post by:
in my dataadapter's command text, I only select the current month records and then use binding manager to bind it. The user can press'button' to move forward or backward to that record. I need to...
2
by: Bob | last post by:
I have noticed that as one adds related tables to a bindingsource and dataset(vs2005 Vb.Net Sql Server 2005), the TODO and following code that fills the datasets on form load are written to the...
4
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a...
3
by: DavidB | last post by:
New to .net....sorry if this seems repetitive I have a dataset ordered by date (SQLDataAdapter SelectCommand uses Order By) and want to find a record by a UniqueID(Identity Column). Then I want...
3
by: shachar | last post by:
hi all. in my dev team we have an argument about retrieving Records from DB to DataSet. the big question is: should i retrieve all the records from my table (max 4000 records) to my DataSet, and...
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
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: 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.