Imports IntraSell_DLL

Public Class AdressenAdresse
    Dim sql = <a>
   SELECT ifnull(a.Name,'') as Name, ifnull(a.Vorname,'') as Vorname, ifNull(a.Firma,'') as Firma, ifnull(a.Adresse,'') as Adresse, ifnull(a.PLZ,'') as PLZ, ifnull(a.Ort,'') as Ort, ifnull(l.Name,'') AS Land 
   FROM ofadressen a, grland l 
   WHERE a.Land = l.IdNr and a.idnr=@IDNR
              </a>.Value

    Dim sqlWeitere = <a>
   SELECT ifnull(a.Name,'') as Name, ifnull(a.Vorname,'') as Vorname, ifNull(a.Firma,'') as Firma, ifnull(a.Adresse,'') as Adresse, ifnull(a.PLZ,'') as PLZ, ifnull(a.Ort,'') as Ort, ifnull(l.Name,'') AS Land 
   FROM `ofadressen-Weitere` a, grland l 
   WHERE a.Land = l.IdNr and a.id=@ID
              </a>.Value

    Sub LadeAdresse(IDNR As Integer)
        Dim sqlA = Replace(sql, "@IDNR", IDNR)
        LadeDaten(sqlA)
    End Sub

    Sub LadeAdresseWeitere(ID As Integer)
        Dim sqlA = Replace(sqlWeitere, "@ID", ID)
        LadeDaten(sqlA)
    End Sub

    Private Sub LadeDaten(sql As String)
        LabelName.Text = ""
        LabelVorname.Text = ""
        LabelFirma.Text = ""
        LabelAdresse.Text = ""
        LabelPLZ.Text = ""
        LabelOrt.Text = ""
        LabelLand.Text = ""

        Dim rs = OpenRecordsetInMemory(sql)
        If rs.Rows.Count > 0 Then
            LabelName.Text = rs.Rows(0)("Name")
            LabelVorname.Text = rs.Rows(0)("Vorname")
            LabelFirma.Text = rs.Rows(0)("Firma")
            LabelAdresse.Text = rs.Rows(0)("Adresse")
            LabelPLZ.Text = rs.Rows(0)("PLZ")
            LabelOrt.Text = rs.Rows(0)("Ort")
            LabelLand.Text = rs.Rows(0)("Land")
        End If

    End Sub

End Class
