473,414 Members | 1,738 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,414 software developers and data experts.

DataTable Question

VS2005

I'm a little bit counfused about the below scenario

An user will be able to write within a combobox control for certain name
,like
he types 'A' and all names begin in 'A' will be filled in combo and he may
want to continue typing as
AD' and all names that begin in 'AD' will be filled respectively
Now it is my question. How to get it fileed more efiicient? I mean each time
the user types a literal i call the function that filter a table in sql
server and returns the data to the combobox OR fill the data table/data set/
array with all data (about 140.000 rows) by default and then loop throu a
datatable and filter there
Any ideas, thanks



Jun 8 '06 #1
1 1840
Hi,

Take a look at the combobox now has some autocomplete features.

http://msdn2.microsoft.com/en-us/lib...tomsource.aspx

Imports System.Data.SqlClient

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strConn As String
Dim da As SqlDataAdapter
Dim conn As SqlConnection
Dim ds As New DataSet

strConn = "Server = .;Database = NorthWind; Integrated Security =
SSPI;"
conn = New SqlConnection(strConn)

da = New SqlDataAdapter("Select * from Products", conn)

da.Fill(ds, "Products")

Dim ac As New AutoCompleteStringCollection
For Each dr As DataRow In ds.Tables("Products").Rows
ac.Add(dr.Item("ProductName").ToString)
ComboBox1.Items.Add(dr.Item("ProductName").ToStrin g)
Next
ComboBox1.AutoCompleteMode = AutoCompleteMode.Append
ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
ComboBox1.AutoCompleteCustomSource = ac
End Sub
End Class
Ken
--------------------
"Uri Dimant" <ur**@iscar.co.il> wrote in message
news:OK**************@TK2MSFTNGP03.phx.gbl...
VS2005

I'm a little bit counfused about the below scenario

An user will be able to write within a combobox control for certain name
,like
he types 'A' and all names begin in 'A' will be filled in combo and he may
want to continue typing as
AD' and all names that begin in 'AD' will be filled respectively
Now it is my question. How to get it fileed more efiicient? I mean each
time the user types a literal i call the function that filter a table in
sql server and returns the data to the combobox OR fill the data
table/data set/ array with all data (about 140.000 rows) by default and
then loop throu a datatable and filter there
Any ideas, thanks


Jun 8 '06 #2

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

Similar topics

5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
2
by: JohnR | last post by:
Sorry if this is has an obvious answer, but I can't find it... I am using a datatable.select to obtain the rows in a datatable that meet certain criteria. My question is this: for each of the...
6
by: Danny Ni | last post by:
Hi, If I want to programatically add rows to a DataTable, do I call AcceptChanges per row? Or do I call AcceptChanges after all rows added? TIA
1
by: kempshall | last post by:
Hi, I have a question about the .NET DataTable.ImportRow method. If I import a DataRow into an empty DataTable, will the empty DataTable pick up the schema of the DataRow I'm trying to put into...
4
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and...
1
by: VMI | last post by:
When my webpage loads the first time, I fill my datatable with records from the DB and display them in my gridview. Once it loads, the user clicks on a button and add records to the datatable,...
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
9
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
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: 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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.