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

Querying a DataSet

Hi All,

I am building an application which needs to search for an address within a
SQL database. The principle is that when you enter the first Alpha charecter
it creates a search string to query the database, there for if you typed in
"10 b" you would retreave all the entries that started with "10 b". However
if I then type in "a" I dont want to re-query that database, instead I want
to query the dataset, i.e. filter all the "10 ba" from the "10 b", and so on.
I can't figure out how to do it.

I hope this make sence.

Does any body have any ideas.

Thanks in advance.
Dave
Nov 21 '05 #1
3 925
Dave,

See for your question my answer I have send to DC in the message after
yours.

Cor
Nov 21 '05 #2
Hi Dave,

I think you're looking for is called a dataview.

Here an example from the help:
Dim custView As DataView = New DataView(custDS.Tables("Customers"), "", _
"CompanyName",
DataViewRowState.CurrentRows)

Dim rowIndex As Integer = custView.Find("The Cracker Box")

If rowIndex = -1 Then
Console.WriteLine("No match found.")
Else
Console.WriteLine("{0}, {1}", _
custView(rowIndex)("CustomerID").ToString(), _
custView(rowIndex)("CompanyName").ToString())
End If
"Dave Prouten" <Da*********@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
Hi All,

I am building an application which needs to search for an address within a
SQL database. The principle is that when you enter the first Alpha charecter it creates a search string to query the database, there for if you typed in "10 b" you would retreave all the entries that started with "10 b". However if I then type in "a" I dont want to re-query that database, instead I want to query the dataset, i.e. filter all the "10 ba" from the "10 b", and so on. I can't figure out how to do it.

I hope this make sence.

Does any body have any ideas.

Thanks in advance.
Dave

Nov 21 '05 #3
Dave,
You can use the DataView to perform the operation that you want. An example
would be:

Private Sub FilterDataTable(SomeDataTable as DataTable, FilterValue as string)
Dim datviewData as DataView
Dim datviewrowData as DataRowView

'create the dataview
datviewData = New DataView(SomeDataTable)

'set the filter
datviewData.Filter = String.Concat("Field_to_filter LIKE '", FilterValue, "%")

'display the data in a list box
For Each datviewrowData in datviewData
lstData.Items.Add(datviewrowData.Item("Field_to_fi lter"))
Next

End Sub
Hope this helps.

Ajay Mirmira

"Dave Prouten" wrote:
Hi All,

I am building an application which needs to search for an address within a
SQL database. The principle is that when you enter the first Alpha charecter
it creates a search string to query the database, there for if you typed in
"10 b" you would retreave all the entries that started with "10 b". However
if I then type in "a" I dont want to re-query that database, instead I want
to query the dataset, i.e. filter all the "10 ba" from the "10 b", and so on.
I can't figure out how to do it.

I hope this make sence.

Does any body have any ideas.

Thanks in advance.
Dave

Nov 21 '05 #4

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

Similar topics

17
by: Dan Koster | last post by:
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHistory). I want to be able to narrow that data down to one specific user, at runtime, without having to make...
3
by: C. Hughes | last post by:
I have a simple application that uses an XML file to store it's data. That means I don't have a seperate database. In order to read the data I created a DataSet that reads my XML file with the...
2
by: Abhishek Srivastava | last post by:
Hello All, Suppose if I have a SQL query like select p.ID, p.NAME, p.UNIT_PRICE, o.QUANTITY from PRODUCT p ORDERS o where p.ID = X AND P.ID = O.ID Here one product can have many orders....
3
by: MDB | last post by:
I'd normally Google for a question like this, and hope to snag a few examples along with the answer, but this time I can't see to get the keywords specific enough. Or I'd ask coworkers, but...
1
by: Michel Moreno | last post by:
Hi everybody, i would like to query the Index Catalog, for a site, as describe in the article: http://support.microsoft.com/default.aspx?scid=kb;en-us;820105 But i'm having an error, I don't know...
6
by: Fred | last post by:
I want to use a dataset so that I can obtain data from a number of sources and put it into one table. Using dataadaptors this seems to work well. Now I have a table (Forecast) in the dataset with...
1
by: sharmaajay | last post by:
hi all, i want to know whether we can make a dataextract function in global page(global.asax) though a query and.. then for each individual .aspx page can we query tht dataset instead of creating...
5
by: sql_er | last post by:
Guys, I have an XML file which is 233MB in size. It was created by loading 6 tables from an sql server database into a dataset object and then writing out the contents from this dataset into an...
2
by: Peter Savas | last post by:
I am new to programming in C#, but have been a VB coder for 16 years, and am facing a problem which I could use some help with: I have an XML file which I am reading into a C# DataSet object with...
2
by: Steven Cheng [MSFT] | last post by:
Hi Cj, I also noticed that the "Act" variable here seems hasn't been declared(or declared anywhere else?). I've try building the same code and got the same result and the "Operator '+' cannot be...
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: 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
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
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
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...

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.