I want parameterize some SQL Statements so my code isn't vunerable to SQL Injections any longer But i have actually no plan how to parameterize for example a where clause.
Dim accID As String = DatabaseConnecter.readField("SELECT ID FROM accounts WHERE accountname ='" & user & "' AND password='" & pw & "';")
The Problem is if you type in a given username, for example test and extend the username with. You can log in without entering the password into the Application.
Edit:
Public Function readField(ByVal sql As String) As String
        Dim output As String = "ERROR"
        Using cn = New MySqlConnection(connString.ToString())
            Using cmd = New MySqlCommand(sql, cn)
                cn.Open()
                Using rd = cmd.ExecuteReader()
                    Try
                        rd.Read()
                        output = rd.GetString(0)
                        rd.Close()
                    Catch ex As Exception
                    End Try
                End Using
                cn.Close()
            End Using
        End Using
        Return output
    End Function
´´´
 
     
    