Solved

searcing table in  Visul Studio

Posted on 2011-09-14
3
289 Views
Last Modified: 2013-11-27
Hi Experts
 I used the following code to get data from sql database
    DA.Fill(DS, "Codes")
        Grid1.DataSource = DS.Tables("Codes")
       when displaying the data in the grid it has so many records with the same CallID.
e.g   callId   Desc
       p001     pads
       p001     pads new
       p001     pads old
       p002   shoes
       p002  shoes l
what I like to see is only 1 line per callID and Desc can be any
e.g  p001     pads
       p002     shoes l
please help
0
Comment
Question by:b001
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Crashman
ID: 36537991
dim dtv as new dataview
Dim dtc As New DataTable

dtv = ds.DefaultView
dtv.Sort = "callId ASC"
dtc = dtv.ToTable("Table", True, "callID")

look
http://msdn.microsoft.com/en-us/library/h2b6ehaa.aspx
0
 

Author Comment

by:b001
ID: 36538205
Hi Crashman
It is giveing me an error
'DefaultView' is not a member of 'system.data.dataset'

on line   dtv = DS.DefaultView
Thanks
0
 
LVL 8

Accepted Solution

by:
Crashman earned 500 total points
ID: 36538340
oh, thats right you must use
ds.table(0).defaultview
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now