473,587 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on DataTable.Selec t

Wan
Hi,
I have a test project which contains two simple forms - 1st form
contains datagrid and couple of buttons. First button to populate the
grid with Northwind.Custo mers records and show 3 columns - CustomerID
|CompanyName| ContactName - works fine.

2nd button to bring up the second form contains a datagrid with
customer records with no sorting or order by. The problem is that when
I select one of the customer records and try to show the selected
record back to the 1st form in the datagrid as:

DataGrid.DataSo urce = DataSet1.Tables (0).Select("Cus tomerID = '" +
sCustID + "'")

the Order of the columns in datagrid changes to - ContactName
|CompanyName | CustomerID. Any ideas?

Regards,
Wan

Jan 4 '07 #1
1 1155
Wan,

If you are using the DataGrid than don't use the Select for that.

Use the DataView or and a new Dataview, with what you can represent the data
in another way

As extra it keeps the rownumber in tact if the user sorts that datagrid by
clicking on top.

Cor
"Wan" <wa****@yahoo.c omschreef in bericht
news:11******** **************@ 38g2000cwa.goog legroups.com...
Hi,
I have a test project which contains two simple forms - 1st form
contains datagrid and couple of buttons. First button to populate the
grid with Northwind.Custo mers records and show 3 columns - CustomerID
|CompanyName| ContactName - works fine.

2nd button to bring up the second form contains a datagrid with
customer records with no sorting or order by. The problem is that when
I select one of the customer records and try to show the selected
record back to the 1st form in the datagrid as:

DataGrid.DataSo urce = DataSet1.Tables (0).Select("Cus tomerID = '" +
sCustID + "'")

the Order of the columns in datagrid changes to - ContactName
|CompanyName | CustomerID. Any ideas?

Regards,
Wan

Jan 5 '07 #2

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

Similar topics

5
2240
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the DataTable first and I then want to roll through the DataTable while in memory checking for errors and then commit the rows to my database table (btw this is in ASP.NET). Is it possible to have data in a datable before attaching at DataAdapter? I'm a...
1
4923
by: MrMike | last post by:
I have the following code which allows me to display records from a table named "lkup_Specie" in a datagrid. If I create a second datatable and a second hashtable for a table named "lkup_Grade", how would I incorporate that logic into my existing logic? Would it go after Next statement? Thanks. Protected specieDataTable As New DataTable 'BEING USED OK Protected specieHashTable As New Hashtable 'BEING USED OK Protected cutDataTable...
3
1392
by: Bruno Rodrigues | last post by:
Hi all I'm using the following code standart in class libraries. I will not split this function in more layers, but I want to know if there are some architetural improvement to do in my code. E.g: Database connection; Try/Catch use; DataTable as a set of rows; etc... Any suggestions are welcome. Thanks!
3
9252
by: Peter | last post by:
Hi, I have two datatables and I want to efficiently query the intersection of the two using the studentID. In my example code below, I want to print out Mary and Jane and their exam grades and I don't want to use loop because the real datatables are much larger. Can this be done using one of the inbuilt methods in the class library and if so how. Thank you in advance Peter DataTable examgrade;
10
2943
by: Shawn Meyer | last post by:
Hello - I am trying to write a class that has an async BeginX and EndX, plus the regular X syncronous method. Delegates seemed like the way to go, however, I still am having problems getting exactly what I want. Here are my goals 1. I would like the IAsyncResult that is returned by the Begin function to be able to be waited on or polled to check for completion. 2. The Begin function would take a callback, and the async process would
1
4031
by: Diffident | last post by:
Hello All, I am trying to filter rows in a datatable based on filtercriteria and sortcriteria using the datatable.select() method. I am encountering a strange behavior in this process. Here is what I am trying to do... ---------
6
2995
by: Woody Splawn | last post by:
I have a Winform where I fill a table with an associated dataset. This will put say 20 records into the table. I know this is elemental but... I want to see only one record from on my Winform from the dataset where the SSN = 547703330. SSN is the primary key for the table. At present I am using code like the following to determine if the specific record exists in the Dataset. Dim dtStudents As DataTable Dim drStudents As DataRow
5
2350
by: ric_deez | last post by:
Hi there, I would like to create a simple search form to allow users to search for a job number based on a number of parameters. I think I understand how to use parameteres associated with Stored Procedures with a data reader to add various parameters. However, if I have a stored procedure such as CREATE usp_SelectfromJobNumbers (@par1 datatype, @par2 datatype, @par3 datatype)
1
2283
by: Kevin S. Goff | last post by:
Someone asked me how I would do the following....suppose you have two ADO.NET datatables, and you want to do the equivalent of SELECT Table1.*, Table2.* (in other words, do a linq query that joins the two, and brings in all columns). For instance... DataTable dtEmps = new DataTable(); dtEmps.Columns.Add("EmployeeID", typeof(Int32)); dtEmps.Columns.Add("Salary",typeof(Decimal));
6
3189
by: fniles | last post by:
I am using VB.NET 2005 and Access database. My program uses a timer that kicks in every 1 min to read from a database and copy the dataset table to a datatable. This database is in a class called clsStat.vb. Then I pass this class to a thread. Each thread will call a function inside the clsStat.vb to do a "Select" of the datatable. Every day around the same time this function that does the select of the databale gets errors like so:...
0
7924
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7854
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7978
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.