Input Box and SQL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When setting up an input box in VB .Net to get a SQL user name for a SQL
connection, if the enter key is pressed on the input box (regardless whether
text has been entered) the program crashes on opening the SQL connection.
The program works fine if the OK button is pressed with the mouse. (A blank
response causes NT authentication, instead of SQL authentication). I have
written the code with both a SQLClient and using ADO, and it fails the same
way with either. What is happening?
 
Are you testing the return value of the InputBox for an empty string before
attempting to use the value? There should be no functional difference in
what button the user presses (or if they hit ENTER for that matter). What
matters is what data you are supplying to the SQL Connection, how you got
that data is irrelevant.

Also, are you aware that the InputBox() function is provided to VB.NET only
for backwards compatibility and that this function is not truly part of
VB.NET?
 
Back
Top