[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


The value of the first 2 columns for all the rows are the same.  how can i use asp.net to display the info look something like this

Posted on 2004-10-29
Medium Priority
Last Modified: 2012-05-05
i called a sql query to a view and return the records below.

PID     Description     PInfoName     pInfoValue
888     Portable PC     Model ID     p909
888     Portable PC     CPU          P4 3.4G
888     Portable PC     Memory          2G RAM

The value of the first 2 columns for all the rows are the same.  how can i use asp.net to display the info look something like this
General Info:
PID     Description
888     Portable PC

Product details info:
Model ID     p909
CPU            P4 3.4G
Memory      2G RAM    
Question by:musclejack
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
  • 3
LVL 19

Expert Comment

ID: 12447326
You are taking the case of only one item
i.e. when PID=888
what if there are 6 records 3 for PID=888 as you have shown
and three for PID=999

Then how would you like to show???
One way is you canhave the PID and Description in one dataGrid and the rest info on the other datagrid
When user selects a row in top Datagrid the bottom one gets populated with details of the particular PID


you can have a Combobox and a Dtatgrid


Author Comment

ID: 12447435
can u give me an simple example?  thx
LVL 19

Expert Comment

ID: 12460684
OK here goes...

What I have done is Add One ComboBox to a Form and Named it CmbPID
And Added a dataGrid called DetailsdataGrid

Then, At Form level declare

    Dim DTDetails As DataTable
    Dim ConStr As String="Provider=..... YOUR CONNECTION STRING ...."

    'On Form Load Call the Function FillData
    Private Sub FrmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub

  'FillData Loads the PID and the Description in a Combo Box. It loads all the unique PIDs
    Private Sub FillData()
        Dim DR As OleDbDataReader
        Dim Cn As OleDbConnection = New OleDbConnection(ConStr)
        Dim Cmd As OleDbCommand = New OleDbCommand("Select Distinct PID, Description From Mytable", Cn) 'Remember the keyword DISTINCT
        'The Qurery will change based on the exact table and Column Names
        DR = Cmd.ExecuteReader
        Do While DR.Read
            Me.CmbPID.Items.Add(DR(0) & " " & Dr(1))
    End Sub

   'Now Whenever you select a PID from the Combo, This event is fired. here we fill the DataGrid with the
'Details of that particular PID which was selected in the Combo
    Private Sub CmbPID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbPID.SelectedIndexChanged
        DTDetails = New DataTable
        Dim DA As OleDbDataAdapter = New OleDbDataAdapter("Select PInfoName,PInfoValue From Mytable Where PID='" & Me.CmbPID.Text & "'", ConStr)
        Me.DetailsDataGrid.DataSource = DTDetails
    End Sub

That's it
I have just assumed a Table named MyTable with 4 columns as mentioned by you
LVL 19

Accepted Solution

arif_eqbal earned 2000 total points
ID: 12460690
A small background what this whole thing will do

We'll have a form with one Combo Box and One DataGrid
ComboBox will have All PIDs and Desctiption eg
888 Portable PC    
999 LapTop

Then whenever you select an Item from the Combo Say 888, the dataGrid will show all the details of it like

Model ID     p909
CPU            P4 3.4G
Memory      2G RAM  


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 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