?
Solved

searcing table in  Visul Studio

Posted on 2011-09-14
3
Medium Priority
?
297 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 2000 total points
ID: 36538340
oh, thats right you must use
ds.table(0).defaultview
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

864 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