Connection to SqlServer

Z

Zanna

Hi,

Someone knows why when I do for the first time a SqlConnection.Open in my
app I got the exception of SQL server not found?

Then I retry the Open and all works...

What's happening?

Thanks
 
Z

Zanna

William said:
Does this happen all of the time? If so, please post the code, this sound
peculiar indeed.

Yes, quite always.

Simply the SqlConnection fails the .Open() the first and sometimes also
the second time.

The connection string is a simply with server name, db name, user id,
password and I put also a time-out of 15 secs.

Tomorrow I will test if this is too few for the first connection, but I
have some dubts :(

Thanks!
 
Z

Zanna

William said:
Definitely post the CS - someone else is having a problem connection to SQL
Server but I haven't experienced this problem, very curious about it though.

Protected dbSql As System.Data.IDbConnection
Private connectionString As String = "Server=MyServer;DataBase=MyDB;User
ID=sa;Password="
....
dbSql = New System.Data.SqlClient.SqlConnection(connectionString)
dbSql.Open() ' here fails with the SqlException "Server SQL not found"
 
I

Ilya Tumanov [MS]

I would suspect you have a network problem.
Try pinging server by name from device and see if it works all the time.
You can use this utility: http://www.cam.com/vxutil_pers.html

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Z

Zanna

Ilya said:
I would suspect you have a network problem.
Try pinging server by name from device and see if it works all the time.
You can use this utility: http://www.cam.com/vxutil_pers.html

I think I found the problem (please don't beat me :) it's not my fault)

If I do it on the winCE 4.1 emulator I got the problem (it's like if
others app that uses TCP-IP such as e-mail clients or so intherfere with
the emulator)

If I do it on the device all sims ok.

I hope this will help someone else.

Thanks
 

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