Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
penguin15793
Starting Member
10 Posts |
Posted - 2008-05-16 : 09:56:26
|
| Hi, I'm slightly familiar with using access to do databasing, but I am now working with sql server and visual studio 2008 programming in vb. This is probably very simple, but I am trying to call a table from a dataset into a datagrid, but the information in the table needs to be relative. This is why I need to create a relationship, however I am unsure how to. I'm not sure if this is done within the sql server or within vs2008 in vb? The tables I am trying to relate are Financial and Demographics with the PK and FK being Patient ID. Can someone please point me to an example or give me a simple one that will explain how I can do this?Thanks! |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-16 : 11:10:45
|
| what do you mean by information needs to be relative? Do you mean you want fields from both tables based on relation b/w them? Then what you need is a simple inner joinSELECT *FROM Financial fINNER JOIN Demographics dON d.PatientID=f.PatientID |
 |
|
|
penguin15793
Starting Member
10 Posts |
Posted - 2008-05-16 : 11:35:17
|
| i'm pretty sure that's what i need, but it still confuses me on where to put commands like that, would it go within my dataadapters before filling them ? example :Dim sqlcmd As SqlCommand = New SqlCommand("SELECT *FROM Financial fINNER JOIN Demographics dON d.PatientID=f.PatientID", conn)Dim sqladapter As New SqlDataAdapter(sqlcmd)sqladapter.Fill(Me.Dataset.Financial) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-16 : 11:54:01
|
| http://www.homeandlearn.co.uk/NET/nets12p5.html |
 |
|
|
penguin15793
Starting Member
10 Posts |
Posted - 2008-05-16 : 15:23:28
|
| Thanks! That page helps a lot. |
 |
|
|
|
|
|