Bei Land (Code nicht dabei) und Bundesland geht es. Bei Region leider nicht. Auch wenn ich "where" weglasse, geht es nicht. idBundesland wird nicht angesprungen, hab schon sehr vieles ohne Erfolg probiert. Arbeite schon 3 Wochen an einer Lösung.
CodeTags gesetzt ~VaporiZed
VB.NET-Quellcode
- Protected Sub idLand_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
- DropDownBundesland.Items.Clear()
- DropDownBundesland.Items.Add(New ListItem("--Select Bundesland--", ""))
- DropDownRegion.Items.Clear()
- DropDownRegion.Items.Add(New ListItem("--Select Region--", ""))
- DropDownBundesland.AppendDataBoundItems = True
- Dim strConnString As [String] = ConfigurationManager _
- .ConnectionStrings("conString").ConnectionString
- Dim strQuery As [String] = "Select Bundesland, idBundesland, idLand from Campingplatz where idLand = @LandID Group BY Bundesland ORDER BY Bundesland ASC"
- Dim con As New MySqlConnection(strConnString)
- Dim cmd As New MySqlCommand()
- cmd.Parameters.AddWithValue("@LandID", MySqlDbType.Decimal).Value = DropDownLand.SelectedItem.Value
- cmd.CommandType = CommandType.Text
- cmd.CommandText = strQuery
- cmd.Connection = con
- Try
- con.Open()
- DropDownBundesland.DataSource = cmd.ExecuteReader()
- DropDownBundesland.DataTextField = "Bundesland"
- DropDownBundesland.DataValueField = "idBundesland"
- DropDownBundesland.DataBind()
- If DropDownBundesland.Items.Count > 1 Then
- DropDownBundesland.Enabled = True
- Else
- DropDownBundesland.Enabled = False
- DropDownRegion.Enabled = False
- End If
- Catch ex As Exception
- 'Throw ex
- Finally
- con.Close()
- con.Dispose()
- End Try
- End Sub
- Protected Sub idBundesland_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
- DropDownRegion.Items.Clear()
- DropDownRegion.AppendDataBoundItems = True
- Dim strConnString As [String] = ConfigurationManager.ConnectionStrings("conString").ConnectionString
- Dim strQuery As [String] = "Select Region, idLand, idBundesland from Campingplatz where idLand = @LandID and idBundesland = @BundeslandID Group BY Region ORDER BY Region ASC"
- Dim con As New MySqlConnection(strConnString)
- Dim cmd As New MySqlCommand()
- cmd.Parameters.AddWithValue("@BundeslandID", MySqlDbType.Decimal).Value = DropDownBundesland.SelectedItem.Value
- cmd.CommandType = CommandType.Text
- cmd.CommandText = strQuery
- cmd.Connection = con
- Try
- con.Open()
- DropDownRegion.DataSource = cmd.ExecuteReader()
- DropDownRegion.DataTextField = "Region"
- DropDownRegion.DataValueField = "idRegion"
- DropDownRegion.DataBind()
- If DropDownRegion.Items.Count > 1 Then
- DropDownRegion.Enabled = True
- Else
- DropDownRegion.Enabled = False
- End If
- Catch ex As Exception
- 'Throw ex
- Finally
- con.Close()
- con.Dispose()
- End Try
- End Sub
CodeTags gesetzt ~VaporiZed
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „VaporiZed“ ()