Hello There,

I am Working with Master Detail Database,
There Many Tables and Columns with Relationship.
One of them 'M_Location' is one Table, and Its Primary Key IS 'LocationID' and Another table is 'D_Trip', so LocationID is used in D_Trip,
now whenever gridview shows data of 'D_Trip', and also show 'LocationID' Field, but its display a Key(Integer), but i want to display its Value From M_Location-LocationName,
So Help To Solve this,,

In WinForms,,
Am Using Code,
Just Like DataGridview.Datasource=ds.tables("tb_Name")

Thanks,
Nilesh

You can look into using LINQtoSQL or some kind of business objects.

LINQ to SQL automatically generates the relationships on object creation. (retrieval)

With a business object model, you will write each object type - giving you complete control over how it acts.

For example:

Public Class Location
    Public Property LocationID
    Public Property LocationName

    Public Sub New()
    End Sub
    Public Sub New(ByVal iID As Integer)
        If Not IsNothing(iID) And iID >= 0 Then
            GetInfo(iID)
        End If
    End Sub

    Public Sub GetInfo(iID)
        'Write code to retrieve information from the database.
    End Sub

    Public Sub Insert()
        'Write code to insert the current instance into the database
    End Sub

    Public Sub Update()
    'Write code to update the current instance in the database
    End Sub

    Public Sub Delete()
    'Write code to delete the current instance from the database.
    End Sub
End Class

Here is a bunch of information on LINQtoSQL.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.