Get data from related tables in SQL database using vb.net DataRow class

45 views Asked by At

I have relational tables like this

Orders: (id, customerId(FK), productId(FK), date)

Customers: (id(PK), name, surname)

Products: (id(PK), name, price)

in Orders table, customerId and productId have foreign keys

And my vb codes like this;

dim da as New SqlClient.SqlDataAdapter("SELECT * from Orders", conn)

dim ds as New DataSet

da.fill(ds, vt)

For each dr as DataRow in ds.Tables(vt).rows
    orderId = dr("id")
    orderDate = dr("date")
    ordererName = 'I want to see customer name here
    ordererSurname = 'I want to see customer surname here
    productName = 'I want to see product name here
    .
    .
    .
Next

above code snippet is an example to explain mu question, actual codes are different. As you can see, i want to get data from related tables by using relational databases

0

There are 0 answers