Solved

searcing table in  Visul Studio

Posted on 2011-09-14
3
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 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