Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do u do a join File in Sql inside the VB

Status
Not open for further replies.

odessa79

Programmer
Sep 16, 2003
31
US
Am tring to join to files in vb here is my code what am I doing wrong?

Set cmd = New ADODB.Command

AdoLoadTasks.ConnectionString = cn400
AdoLoadTasks.RecordSource = "SELECT * FROM ENPRAWD02.PRJTSKPF a " _
& "JOIN ENPRAWD02.TSKPF b On a.tsknbr = b.tsknbr" _
& "WHERE a.prjnbr = " _
& "(" & cmbProjectNumber.Text & ") " _
& "ORDER BY a.tsknbr"
AdoLoadTasks.Refresh

MSHFlexGrid1.Visible = True

'Set DataGrid1.DataSource = AdoLoadTasks
Set MSHFlexGrid1.DataSource = AdoLoadTasks


Its telling me that token A is not valid
 
Code:
&quot;SELECT <Fields>
FROM PRJTSKPF a INNER JOIN TSKPF b ON
a.tsknbr = b.tsknbr
WHERE a.prjnbr = &quot; & cmbProjectNumber.Text _
& &quot; ORDER BY a.tsknbr&quot;
Where <Fields> is the list of fields you want to retrieve complete with table aliases:
Code:
SELECT a.this, b.that, a.other, and so on.
Hope this helps.

Andy
&quot;Logic is invincible because in order to combat logic it is necessary to use logic.&quot; -- Pierre Boutroux
&quot;A computer program does what you tell it to do, not what you want it to do.&quot; -- Greer's Third Law
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top