Subject Re: Visual Basic - ADO - Select From blah Where blah = blah1 SQL Statements
Author Adam
Not answering your question here, someone with more VB knowledge may
need to point you in the right direction, which may also be pointing
you to another list because it seems to be more a VB / ODBC issue.


> SQL = "SELECT * FROM USERS WHERE USERNAME='" & userName & "'"
> rs.Open SQL, cnBase, adOpenDynamic, adLockOptimistic

But I need to point out that your code is begging to be compromised
through an SQL Injection attack.

(http://en.wikipedia.org/wiki/Sql_injection)

Most languages and connection components provide some facility to use
paramatised queries to avoid this potential.

eg. Delphi + IBX.

qry.Text := 'SELECT * FROM USERS WHERE USERNAME= :UserName';
qry.ParamByName('UserName').Value := userName;
qry.Open;

The usual warnings about never selecting '*' also apply.

Adam