SQLException Error

D

Dan

Hi everyone,

I have written a VB .Net application for Pocket PC. I am able to
connect to a test SQL Server with no issue, everything works great. I
have another server that I am trying to connect to, but I believe I am
running into an authentication issue.

I have declared the following in a module:

Public dbConn As New System.Data.SqlClient.SqlConnection

and the following is where I am getting an error:

Private Sub frmShipment_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
dbConn.ConnectionString =
"Server=10.0.0.39,1433;Database=Axxis;user id=sa;pwd=cars"
dbConn.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

The error "SQLException" is occuring at the dbConn.Open() statement.

The SQL Server is setup for mixed mode authentication. I've tried
different variations of the Server address... nothing works.

Any suggestions?


Thanks,

Dan
 
D

David McNamee

Dan said:
dbConn.ConnectionString =
"Server=10.0.0.39,1433;Database=Axxis;user id=sa;pwd=cars"

Are you trying to use TCP/IP instead of named pipes? You need to include
"Network Library=DBMSSCON;" in the connection string. See
http://www.connectionstrings.com for an example. Also, 1433 is the default
TCP port - might your DBA have configured a different port?

-david
 
S

Sergey Bogdanov

What do you have in SqlException.Errors when the exceptions was thrown?
Can you ping the server from device? It's quite possible that you just
can't connect to 10.0.0.39 (e.g. issue with firewall). Also check your
connection string and try something like this:

Integrated Security=false;User
ID=<username>;Password=<passwo­rd>;Initial Catalog=<databasename>;Data
Source=<servername>
 
D

Dan

Hi Sergey,

The error is only telling me SqlException. Not much help there..

I'm using TCP/IP... I can ping the server from the device by using the
computer name and the IP Address. I have tried turning off the
firewall, creating an exception for SQL Server Port 1433... no luck
there either.

Just for kicks, I tried creating a DSN on the server... I attempted to
use SQL Authentication instead of Windows authentication using the
correct username and password... and I got an "SQL Server Does Not
Exist or Access Denied" error. In enterprise manager, the SQL instance
is setup for SQL Server and Windows authentication. If I run Query
Analyzer and connect using SQL Authentication.. it will let me connect
using the (local) selection. If I try connecting with the IP address
or the computer name... I get the access denied.

I am running XP Pro with SP2 and the MSDE SQL Server...

Any suggestions?


Thanks,

Dan





Sergey said:
What do you have in SqlException.Errors when the exceptions was thrown?
Can you ping the server from device? It's quite possible that you just
can't connect to 10.0.0.39 (e.g. issue with firewall). Also check your
connection string and try something like this:

Integrated Security=false;User
ID=<username>;Password=<passwo­rd>;Initial Catalog=<databasename>;Data
Source=<servername>


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Hi everyone,

I have written a VB .Net application for Pocket PC. I am able to
connect to a test SQL Server with no issue, everything works great. I
have another server that I am trying to connect to, but I believe I am
running into an authentication issue.

I have declared the following in a module:

Public dbConn As New System.Data.SqlClient.SqlConnection

and the following is where I am getting an error:

Private Sub frmShipment_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Try
dbConn.ConnectionString =
"Server=10.0.0.39,1433;Database=Axxis;user id=sa;pwd=cars"
dbConn.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

The error "SQLException" is occuring at the dbConn.Open() statement.

The SQL Server is setup for mixed mode authentication. I've tried
different variations of the Server address... nothing works.

Any suggestions?


Thanks,

Dan
 
S

Sachin Palewar

Just a little suggestion, can you convert your CF code to a .net code
and debug it as a standard windows application? I have tried this
method a couple of times when encountering SQLCEexception, as error
messages are more descriptive and helpfull when you are debugging a
desktop application.

Cheers!

Sachin Palewar
www.palewar.com
 
D

Dan

Hi everyone,

I found a little love note from Microsoft in my logs that the external
ports for SQL Server were disabled due to a security vulnerability and
that I needed to download a patch. I downloaded the Service Pack 4
that was just recently released and everything is working perfect now.



Thanks for the assistance!

Dan
 
G

Guest

Hi,

I'm facing the smae problem, and unable to connect to the Sql server from
the handheld.

When I run the application, I'm getting the error 'Sql Exception'

ex {"SqlException" }
[System.Data.SqlClient.SqlException]
Message SqlException
Count 1
errors {Count=1}
Item <cannot view indexed property>
Item <cannot view indexed property>
System.Collections.ICollection.IsSynchronized FALS
System.Collections.ICollection.SyncRoot {System.Data.SqlClient.SqlErrorCollection}
LineNumber 0
Message General network error. Check your network documentation.
Number 11
Procedure ConnectionRead (recv()).
Server XXXXXXXXXXXXXX - SERVER IP address
Source .Net SqlClient Data Provider
State 0
System.Object {System.Data.SqlClient.SqlException}
_innerException { }
_message SqlException
InnerException { }
Message SqlException

Getting the same error even after installing the Service Pack 4.
Any suggestions, greatly appreciated

regards,
srinivas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top