[RESOLVED] SqlClient.SqlConnection not working.
This line of code has been working to my SQL 2000 instance on my laptop for months.
Now I'm trying to connect to a network server - and it's failing. That server is running SQL 2005.
Do I have to install something on the network server to get this to work for me??
Code:
Imports System.Data.SqlClient
.
.
.
Dim LDcn As New SqlConnection
Dim booGoodLoad As Boolean = False
LDcn.ConnectionString = "Data Source=" & APCSettings.sServer _
& "; Initial Catalog=" & APCSettings.sDatabase _
& "; Integrated Security=SSPI; User Id=" _
& APCSettings.sUserId & "; Password=" & strPassword
Re: SqlClient.SqlConnection not working.
Ok - it's even worse - I just tried this:
Code:
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
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
End Sub
End Class
Back to opening a connection on my laptop - something that worked back in this thread months ago
http://www.vbforums.com/showthread.php?t=460915
And now I'm getting:
?ex.Message
"Specified SQL server not found: fps-lap-sz"
Re: SqlClient.SqlConnection not working.
Ok - I just started a new project - not a Pocket PC 2003 project but just a regular windows app
Put this same code in
Code:
Imports System.Data.SqlClient
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
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
End Sub
End Class
and it found the server and opened the database fine.
Why would VS under a PPC 2003 app not let this exact same code work?
I did have to add two ref's for the PPC 2003 app - System.Data and System.Data.SqlClient.
Re: SqlClient.SqlConnection not working.
Hi,
the string i use to connect to a Sql2000 base is "Persist Security Info=False;Integrated Security=False;Server=delldesktop,39250;initial catalog=Waiter;user id=sa;password=;"
Pete
Re: SqlClient.SqlConnection not working.
@Petevick - I resolved this (I do believe) after installing a couple of downloads from MS and selecting "repair" - SQL CE was one of them - not even sure what the other one was.
So I'm back to normal - can open the SQL 2000 and SQL 2005 DB's with any of the connection strings I showed above.
btw - we need to use Windows Authentication - that's why my first post has the SSPI along with Windows Un/Pw.
Re: [RESOLVED] SqlClient.SqlConnection not working.
This is back to [NOT RESOLVED].
Having problems opening network DB's from my laptop using the emulator. Seems that it's "only" seeing the local sql server 2005 express on the laptop - that is grabbing the connection even though we are asking to open a network DB.
Anyone else ever experience this?
Anyone know of MS acknowledging this error or releasing fixes for it?
Re: [RESOLVED] SqlClient.SqlConnection not working.
I don't if it is mentioned before but u should ip address for server not Name...like Server = 192.168.1.2,1433
At least this works for me
Re: [RESOLVED] SqlClient.SqlConnection not working.
how are you trying to open the database from the emulator (ie what is the connection string?)
Re: [RESOLVED] SqlClient.SqlConnection not working.
Ok - sorry it takes me so long to get back in - Sept is busy in the k-12 school marketplace...
This code
Code:
Dim LDcn As New SqlConnection
Dim booGoodLoad As Boolean = False
LDcn.ConnectionString = "Server=" & APCSettings.sServer & "; Initial Catalog=" & APCSettings.sDatabase & "; Integrated Security=SSPI; User Id=" _
& APCSettings.sUserId & "; Password=" & strPassword
Try
LDcn.Open() ' This line of code works on the DEVICE - not on the EMULATOR!
Catch ex As SqlException
If ex.Number = 18452 Then
MessageBox.Show("Invalid password - try again!")
Else
MessageBox.Show(ex.Message, "Error")
End If
Exit Sub
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
Exit Sub
End Try
works nicely with a PPC docked - using the "Pocket PC 2003 Device" itself - and not the emulator.
Here is the simple connection sting
Code:
?ldcn.ConnectionString
"Server=Fpssql05; Initial Catalog=stufiles; Integrated Security=SSPI; User Id=szlamany; Password=xxx"
* It has a password - that's how SSPI works from the PPC to the network
* After the connection opens - after stepping over that line of code
* the connection string changes to the following...
?ldcn.connectionstring
"Server=Fpssql05; Initial Catalog=stufiles; Integrated Security=SSPI; User Id=szlamany;"
The server is called Fpssql05 - I am sitting in my dining room VPN connected to this large WAN - and that is the server name on the network.
@masteripper : I do not need to use the IP address - it's working fine
I currently just "stepped" past the LDcn.Open() statement in code.
And it's working in production for fifty users who work on that network.
Now I change VS to "Pocket PC 2003 SE Emulator" and run the project.
I get the exact same connection string
Code:
?ldcn.ConnectionString
"Server=Fpssql05; Initial Catalog=stufiles; Integrated Security=SSPI; User Id=szlamany; Password=xxx"
I get this error message
Code:
?ex.Number
6
?ex.Message
"Specified SQL server not found: Fpssql05"
Nothing has changed just now except using a different device - the emulator.
Now - I've got a spare PPC - I'll dock that one.
It's deploying the NETCFv2.wm.ARMV4I.cab file and others - deploy succeeded...
Run fails - can't find PInvoke DLL 'sqlceme30.dll'...
Well that's enough in one post - I've got to look into why this spare PPC isn't working...
Re: [RESOLVED] SqlClient.SqlConnection not working.
Have you tried it with a 'docked' emulator??
Re: [RESOLVED] SqlClient.SqlConnection not working.
Quote:
Originally Posted by petevick
Have you tried it with a 'docked' emulator??
Docked emulator? And isn't the emulator always docked?
Re: [RESOLVED] SqlClient.SqlConnection not working.
Hi,
sorry - meant 'cradled' try from VS2005
Tools>Device Emulator Manager
Then right click on your connected emulator, and choose 'cradle' - you should be able to see the network completely then
Re: [RESOLVED] SqlClient.SqlConnection not working.
I cradled it in VS and got the same error.
I never needed to manage the cradling of the emulator before - I've seen that window but never did anything with it.
Does it normally just come up cradled by default?
Re: [RESOLVED] SqlClient.SqlConnection not working.
cradling it allows it to 'see' the network, so you should be able to use PIE etc
Re: [RESOLVED] SqlClient.SqlConnection not working.
Well i have to find some little time to try it but i trust you....:)
This is probably going to save me some serious time.Time to move on
Re: [RESOLVED] SqlClient.SqlConnection not working.
Quote:
Originally Posted by petevick
cradling it allows it to 'see' the network, so you should be able to use PIE etc
PIE? Pocket IE?
When I try to use IE from the PPC I'm getting "no network or modem"...
When I try to use Term Serv Client - I cannot connect to the server called FPSSQL05.
What kind of network am I supposed to see from the PPC?
Re: [RESOLVED] SqlClient.SqlConnection not working.
Hi,
it should connect to activesync, so then you should be able to see the network as you would from a 'cradled' device.
Obviously, it won't connect through activesync if you already have a device connected - otherwise, it works exactly like a cradled device.
PIE - Pocket IE
Pete
Re: SqlClient.SqlConnection not working.
I got this solved from a MS forum
Quote:
And you have cradled the emulator? (In AciveSync, File, Connection Settings, allow connections via: DMA, in Device Emulator Manager, right click the device, and select Cradle)
I had changed the ACTIVESYNC to INFRARED connections sometime back - it needed to be set to DMA.
I don't know why an ACTIVESYNC setting would have anything to do with SQLCLIENT.SQLCONNECTION - but it did.
This is now working.