If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > SQL data selection from 2 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-24-08, 11:51
kdeutsch kdeutsch is offline
Registered User
 
Join Date: Mar 2008
Posts: 5
Unhappy SQL data selection from 2 tables

What I have is a dropdown box on a asp.net page that when a selectedindexchanged event happens, it will look at sql code that will pull up the appropriate records. What I need to happen is that I pull all taskforces that are assigned to a mission. MY taskforce and mission tables are seperate but missionID is a foregin key in the taskforce table. when i pull up a Mission from the dropdown box it should list all task forces in a datagrid that belong to that mission. For some reason not working. Any Ideas.

Private Sub DDLSADName_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLSADName.SelectedIndexChanged

'Populate the DataGrid based off on what was selected from ddlSADName
Dim SadName As Integer = DDLSADName.SelectedValue
Dim strcommand As String

If SadName <> 0 Then
strcommand = "select inttaskForceId from tblTaskForce where inttaskforceid = " & SadName & " order by inttaskforceid "

'retireve value from database according to selected item
myDataTable = getData(sql)
myDataGrid.DataSource = myDataTable
myDataGrid.DataBind()

End If
End Sub
Reply With Quote
  #2 (permalink)  
Old 03-25-08, 04:24
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Code:
where inttaskforceid = " & SadName
I'm guessing inttaskforceid is of integer datatype, and SadName is of text datatype?
Can you post the completed SQL string back here?
__________________
George
Twitter | Blog
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On