[RESOLVED] Trying to use SQL Client to open laptop SQL from PPC
Any ideas why this won't work?
Code:
Dim LDcn As New SqlConnection
LDcn.ConnectionString = "Data Source=fps-lap-sz; Initial Catalog=Stufiles; User Id=apcload; Password=apcload"
Try
LDcn.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
fps-lap-sz is the name of my laptop - it's got SQL server 2000 running on it. The ex.Message shows up as a meaningless "SqlException"
StackTrace is...
Quote:
?ex.StackTrace
"at System.Data.SqlClient.SqlConnection.OnError()
at System.Data.SqlClient.SqlInternalConnection.OnError()
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run()
at System.Data.SqlClient.TdsParser.Run()
at System.Data.SqlClient.SqlInternalConnection.Login()
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor()
at System.Data.SqlClient.SqlConnection.Open()
at APC.APC.LoadDatabase()
at APC.APC.Button_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at APC.APC.Main()
"
Re: Trying to use SQL Client to open laptop SQL from PPC
ok - fixed this one myself...
Created another VS2005 project - a regular one - not CE - and put that same code in.
Got a better error message:
"Login failed for user 'apcload'. Reason: Not associated with a trusted SQL Server connection."
Of course my laptop was setup for Windows authentication only - I changed it to mixed mode and now that code on the PPC runs fine...
Re: [RESOLVED] Trying to use SQL Client to open laptop SQL from PPC
I'm having this problem, too.
I see you solved it by changing the authentication mode on your laptop. Is this where SQL Server 2000 is running?
We have SQL Server 2000 running on a local server in mixed mode (Windows and SQL Authentication), and we have a userid set up that has rights to everything called "public" (password is also "public", so now you can hack our systems - if they were online).
If I use this connection string, reading from SQL will fail:
Code:
Data Source=WKAPP;Initial Catalog=IOResults;User ID=public;Password=public
The error message is "Login failed for user 'public'."
The first line of the stack trace says " at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)".
With that being said, if I use this connection string, the SQL queries work:
Code:
Data Source=WKAPP;Initial Catalog=IOResults;Integrated Security=True;User ID=public;Password=public"
How is the "Integrated Security" feature getting my connection through? Do the individual PCs need to have Mixed Mode authentication enabled (somehow)?
Re: [RESOLVED] Trying to use SQL Client to open laptop SQL from PPC
Welcome to the forum!
Actually - this thread was back in my salad days - before I knew that you could use integrated security from a pocket pc.
We now use connection strings like
Code:
"Server=Fpssql05; Initial Catalog=stufiles; Integrated Security=SSPI; User Id=szlamany; Password=xxx"
I am actually credited with giving that connection string to www.connectionstrings.com - they put me on their thank you page!
Re: [RESOLVED] Trying to use SQL Client to open laptop SQL from PPC
Thanks for the warm welcome!
So, if you use Integrated Security in your connection string (SSPI), why specify the User Id and Password as well?
While I have an MVP listening to me, can you tell me why Microsoft wants us to use SSPI instead of True? I know they mean the same thing, but I also know that Microsoft recommends using SSPI instead. The only problem is I get the lettering confused when going from memory sometimes and write SSIP or something like that.
Back to my problem at hand: We have PCs out on the production floor of our factory, and they are all running with the User Id "public" and the Easy To Remember Password of "public" as well. (now you can hack our systems!)
Since low-paid employees can't always be trusted with PCs, the "public" account under User Accounts is Restricted (no surfing the web, can't install programs, etc.). But, with this account being Restricted, it can not connect to SQL Server.
Is there a way around this? The System Administrator is convinced that it is my software that is causing this, and that it is not his Local or Group Policy. That may be, but I just do not know.
Re: [RESOLVED] Trying to use SQL Client to open laptop SQL from PPC
This is a pocket PC app - right?
True and SSPI seem to be equivalent - but that's now and that's with the providers we are all using. MS recommends SSPI (from what I just googled) - so that must mean something more long-term for them...
Security Support Provider Interface - it's a MS API
http://en.wikipedia.org/wiki/Securit...ider_Interface
Integrated security basically means that the connection will inherit the security of the logged in user.
Since PPC's don't log in there is a requirement to actually specify the un/pw (of the domain!) when using SSPI/integrated security. What's actually really nice about that is you can impersonate a different domain user from the PPC without actually logging in as that user.
So at any rate - from a PPC - if you want to use WINDOWS AUTHENTICATION you must use the connection string as I showed it.
And of course the benefit you have is that the "actual workstation" can be logged into any username you want and the PPC can still specify SSPI with a different windows username.