Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
greaseman
Starting Member
30 Posts |
Posted - 2006-06-08 : 09:06:39
|
| I have a Visual Basic application that connects to a SQL server database. In my application, I have a login screen that is supposed to pause the application (it's coded as modal) and ask the user for a login and password. I have my connection string and user set up to use Windows NT authentication.However, what is happening with my application is that as soon as I start the program, it never stops at the login screen, but instead goes right into the application.Is this "normal" when using Windows NT authentication? What causes this behavior? How can I make my program stop at the login screen, and more interestingly, would I want to stop at a login screen?Thanks in advance to all who reply. This is driving my crazy!This forum is best viewed with a computer. Questions asked freely. Confusion happily shared. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-06-08 : 09:35:24
|
| If you are using integrated security then you don't need to ask the user for a login or password (in fact they will be ignored) but the app would still stop at that form as it doesn't know how it's going to connect.Check your startup form to see if it is set to that form or to another or sub main.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
greaseman
Starting Member
30 Posts |
Posted - 2006-06-08 : 09:56:37
|
nr,Thanks for replying. I found what the cause was. In my code (snippet follows), I was checking for a piece of the connection string that looked for "...Integrated Security=SSPI....". If I found that particular piece, then the code was blowing by the code that would open the login form.Code:If strConnect <> gcstrREG_DEFAULT Then(This next line was the culprit!!) If InStr(strConnect, mcstrINTEGRATED) = gcintZERO Then frmLogin.Login strConnect, strUser, strPass If Right(strConnect, gcintONE) <> cstrCONN_STR_DELIMITER Then strConnect = strConnect & mcstrCONN_STR_DELIMITER End If If strUser = "" And strPass = "" Then strConnect = "" Else If InStr(strConnect, gcstrODBC_PROVIDER) > 0 Then strConnect = Left(strConnect, InStr(strConnect, gcstrEXT_PROPERTIES)) & gcstrPWD_ENTRY & strPass & mcstrCONN_STR_DELIMITER & Mid(strConnect, InStr(strConnect, gcstrEXT_PROPERTIES) + 1) strConnect = Left(strConnect, InStr(strConnect, gcstrEXT_PROPERTIES)) & gcstrUID_ENTRY & strUser & mcstrCONN_STR_DELIMITER & Mid(strConnect, InStr(strConnect, gcstrEXT_PROPERTIES) + 1) Else strConnect = strConnect & gcstrUSER_ENTRY & strUser & mcstrCONN_STR_DELIMITER strConnect = strConnect & gcstrPASSWORD_ENTRY & strPass & mcstrCONN_STR_DELIMITER End If End If End IfIt certainly is frustrating, when you inherit someone else's code that has not been internally documented, which is my case.Again, thanks for replying! This forum is best viewed with a computer. Questions asked freely. Confusion happily shared. |
 |
|
|
|
|
|
|
|