Log in

View Full Version : Connect to MS sql database from pocket pc


frigsfrogs
06-03-2005, 08:41 AM
Hey

I need to connect directly to an MS SQL database on the internet from my pocket pc (hp 4700). i have looked for quite a long time but i can only find something about remote data access. but that requires an IIS on the server on the internet. i don't have iis on that server. just a database. the language is VB.NET.

Is it possible to connect directly (with the ip-address, username, password) to the database?

/Carsten

Peter Foot
06-03-2005, 10:40 AM
Using VB.NET you can add the System.Data.SqlClient reference to your project, this allows you to connect directly to a remote SQL database. It works just like the SqlClient provider in the desktop .NET framework.

Peter

frigsfrogs
06-03-2005, 12:58 PM
I used sqlclient on my pocket pc. sqlconnection (on pc) became sqlCeConnection etc. but when i define my sqlCeConnection(" here ") it will not work with the same string as on pc.

I tried different things for example: SqlCeConnection("Data Source=IP; pwd=myPassword; uid=myUsername; Database=myDatabase") but it doesn't work.

how should the connection-string look like?

Peter Foot
06-03-2005, 01:34 PM
SqlCe* are classes for working with local Sql Server CE databases on the device. you code should look something like:-

Dim connection As New SqlConnection("Data Source=IP; pwd=myPassword; uid=myUsername; Database=myDatabase")
connection.Open()

etc

Peter

frigsfrogs
06-03-2005, 02:09 PM
Oh my god, your a life-saver!

its apparently the same code on pc and pocket pc. Only differens is to add the reference.

Thank you very much :D