Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2008

    Unhappy Unanswered: SQL data selection from 2 tables

    What I have is a dropdown box on a 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

    End If
    End Sub

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 10
    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?
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts