473,770 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to find a record in a dataset?

Rom
Hi,
How can I find a record in a dataset. I have 1 textbox name txtfind.
my sql statement should be like this.."select * from employees where emp_id= txtfind.text" then if found it should bind the fields to the corresponding textboxes on the form.
Nov 20 '05 #1
1 7285
You can use a datatable.selec t or prefably Use a dataview like in this
example provided by Cor or this link from Bill Ryan
http://www.knowdotnet.com/articles/a...rowfilter.html

See below this for example of datatable.selec t
------------------------

Hi Gene,

In addition to Jay B.

I also suggest to use the dataview.
\\\
dim dv as new dataview(mydata set.tables("myt able")
dv.rowfilter = "mysortitem < 100"
dv.sort = "mysortitem "
mycombobox.data source = dv
mycombobox.disp laymember = "xx"
///
This give you with a miniumum of code the maximum results in my idea.

Cor
-------------------------

Or datatable.Selec t example from BinSong....
---------------

Hi, Stu

Can you try this:
DataRow[] drReviewers = ReviewerDS.Tabl es["Menu"].Select("","Men uItem");
ReviewerMenu.Da taSource = drReviewers;
ReviewerMenu.Da taBind();
If not working, You might try the following because you are sorting only
instead of filtering and sorting:
DataView dvReviewer = ReviewerDS.Tabl es["Menu"].DefaultView
dvReviewer.Sort = "MenuItem"
ReviewerMenu.Da taSource = dvReviewer;
ReviewerMenu.Da taBind();
Hope this helps

Bin Song, MCP
"Rom" <Ro*@discussion s.microsoft.com > wrote in message
news:AE******** *************** ***********@mic rosoft.com:
Hi,
How can I find a record in a dataset. I have 1 textbox name txtfind.
my sql statement should be like this.."select * from employees where
emp_id= txtfind.text" then if found it should bind the fields to the
corresponding textboxes on the form.


Nov 20 '05 #2

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

Similar topics

4
3931
by: dkalsow | last post by:
Ok, I have the following code. Does any one know how I go about taking this record set and trying to find if a record exits in it? - Thanks Dale Imports System.Data.SqlClient Public Module modLoadDefaults Public gCONN As New SqlConnection Public gbMakeConnection As Boolean Public rsUsers As New Data.DataTable("Users")
0
3645
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
0
1929
by: Eric Paul | last post by:
I have been in search of a better way to handle bulk inserts and updates into SQL 2000 using c# and while I have found a few different ways to accomplish this I was wondering what is considered to be the "BEST" method. Scenario: Every day I have a CSV file which is intended to both update and add records to a SQL table. There is a matching ID column in the CSV file and in the SQL table, when a match is made an update is performed,...
6
5072
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
2
2400
by: Brad | last post by:
I have a quandry which hopefully is easy for most. I have a table that represents about 5,000 genetic dog records. This data is being extracted from an AS400 database. Each dog's record includes the Sire and the Dam number which is also contained somewhere within the main table. What I need to do is to find the name of the Sire and/or the Dam instead of just giving the primary key record as it is currently stored. Here is what I...
1
2739
by: Ranny | last post by:
Question: What is the process to Insert a record using Dataset and SQLDataAdapter? Explanation: Thanks to Cor I am able to get a record to load, modify it, and save it to the database. My current problem is one of my fields is NOT NULL and a primary key. I want to be able to open the form with the fields blank (new record). My current thinking is: 'Create the SQL Connection, DataAdapter, and DataSet mySQLConnection = New...
3
2415
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
7
2011
by: Peter | last post by:
How do I do Search in DataGridView and make the found row visible in UI? Thanks Peter
1
1233
by: Coty | last post by:
Here's the problem I'm having. I write a record to backend database and upon the postback my record set is not showing the record I just added. If I close the page totally and reopen the page it will show up, or if I add a second record the first will show upon the postback of the page but the second one won't. My dataset is loaded descending so the record I just added should be the first one in the datagrid. I've tried resetting the...
0
1365
by: JoaquimC | last post by:
Hello, I'm new to c#, and i am trying to implement the following behaviour to a DataGrid: When i locate a record in one DataTable i want to select and show the respective grid row in the DataGrid. The DataGrid.DataSource is a DataSet called 'MinhaTabela'. The DataGrid.DataMember is a DataTable from that DataSet, called 'Nomes'. When i find one record on that DataTable i want that the respective row in the DataGrid is selected.
0
9454
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
10260
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...
1
10038
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
9906
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
8933
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...
0
5354
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...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.