Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ASP: DB auslesen

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

kann mir jemand sagen, wie ich mit ASP.NET zwei Werte aus einer DB auslesen kann.

Die Tabelle(Login) sieht wie folgt aus:

Benutzername | Passwort

-------------------------

test1 | test123

test2 | test456

Ich komme im Code nicht klar. Bei anderen DB-Zugriffen fülle ich ganze Tabellen aber hier schaffe ich es nicht 2 Werte auszulesen.

Vielen Dank für eure Hilfe

Bei mir sieht es wie folgt aus. Ich bekomme immer einen Lese-Fehler. Obwohl das SQL Statment was finden sollte.

SQL Statment

SELECT Name,Vorname

FROM Users

WHERE UserId = @Übergabeparameter;

Function GetLoginUser(ByRef UserLogin As String) As String


        Dim glob As New Global


        Dim sqlString As String = glob.getSearchResource("SQL_USERLOGIN")


        Dim myConnection As New SqlConnection(ConnectionString)

        Dim myCommand As New SqlCommand(sqlString, myConnection)

        myCommand.Parameters.Add("@UserLogin", UserLogin)


        myConnection.Open()


        Dim reader As SqlDataReader '= myCommand.ExecuteReader(CommandBehavior.SingleResult) 'CloseConnection)

        reader = myCommand.ExecuteReader()


        Dim t As String = CType(reader.GetValue(reader.GetOrdinal(reader.GetName(1))), String)



        'UserLogin = CType(reader.Item("Name"), String)


        reader.Close()


        Return UserLogin

        End Function

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.