Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts

Thursday, March 22, 2012

Can not connect to desktop sql database from mobile device (Pocket PC)

Hi,

I am developing an application for a Pocket PC (PPC). I am using Visual studio 2005, and the Operating system on this PPC is Window Mobile 2003 SE. The followings are my codes to connect PPC with the database on my PC with sql server 2005. But when I cick the button1, the error with "SQL Server does not exist or access denied." Any ideas? Thanks a lot.

Imports System.IO

Imports System.Data

Imports System.Data.SqlClient

Imports System.Math

Imports System.Drawing

Imports System

Public Class Form1

Dim strConnection As String = "Server=localhost;Integrated Security=SSPI;database=AdventureWorks"

Dim strQuery As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Label1.Text = "Hello, Clicking after."

ReadOrderData()

End Sub

Private Sub ReadOrderData()

Dim queryString As String = "select * from Person.Address where AddressID < '10'"

Using connection As New SqlConnection(strConnection)

Dim command As New SqlCommand(queryString, connection)

connection.Open()

Dim reader As SqlDataReader = command.ExecuteReader()

While reader.Read()

MsgBox(String.Format("{0}, {1}", _

reader(0), reader(1)))

End While

reader.Close()

End Using

End Sub

End Class

Please see this:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=184007&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=235638&SiteID=1

If it still does not work after you fixed your 'localhost' issue:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=270532&SiteID=1

Also, we have forum dedicated to SQL Mobile. Please post to it should you have any SQL or SQL Mobile related questions:

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=152&SiteID=1

|||

Thanks for your reply.

I would like to install vxUtil, and I have already read the readme.txt file. But I still have some questions about that. Should vxUtil be installed on my personal PC or the Pocket PC(PPC)? If it should be installed in the PPC, how can I install? In the readme.txt, I get the following information:


Open the appropriate folder on the hard drive then double-click
on the InstallCE icon to start the install process for the correct device.

From this information, I feel that vxUtil should be installed in my personal PC. Is it correct?

Could you please answer me about that?

Thanks a lot.

|||

vxUtil should be ultimately installed on device. However, like pretty much all Pocket PC products, it goes through desktop and Active Sync. You install/unzip application on to desktop, then you (or desktop installer) execute something which would push it to device via AS. As a developer you would have to do the same for your application eventually. In some cases there's no desktop installer, just a device CAB file. In that case simply copy CAB to device and click on it from device's file explorer.

|||

Dear Ilya Tumanov,

Your answer is so great. I have already installed it into the PPC, and it scanned the ports in my desktop PC. From the result, the ports 25, 80, 135, 139, 443, 445, 990 and1025 are all open. But the program that I posted yesterday and listed above can not still work. What do I need in the next step?

Moreover, I have changed the connection string to

Dim strConnection As String = "Server=Server1;Integrated Security=SSPI;database=AdventureWorks"

Thanks a lot.

|||

Hi,

I am developing an application for a Pocket PC (PPC). I am using Visual studio 2005, and the Operating system on this PPC is Window Mobile 2003 SE. The followings are my codes to connect PPC with the database on my PC with sql server 2005. But when I cick the button1, the error with "SQL Server does not exist or access denied."

I have already installed vxUtil into the PPC, and Ping is OK. I use it to scan the ports in my desktop PC. From the result, the ports 25, 80, 135, 139, 443, 445, 990 and1025 are all open. But the program can not still work.

Any ideas? Thanks a lot.

Imports System.IO

Imports System.Data

Imports System.Data.SqlClient

Imports System.Math

Imports System.Drawing

Imports System

Public Class Form1

Dim strConnection As String = "Server=server1;Integrated Security=SSPI;database=AdventureWorks"

Dim strQuery As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Label1.Text = "Hello, Clicking after."

ReadOrderData()

End Sub

Private Sub ReadOrderData()

Dim queryString As String = "select * from Person.Address where AddressID < '10'"

Using connection As New SqlConnection(strConnection)

Dim command As New SqlCommand(queryString, connection)

connection.Open()

Dim reader As SqlDataReader = command.ExecuteReader()

While reader.Read()

MsgBox(String.Format("{0}, {1}", _

reader(0), reader(1)))

End While

reader.Close()

End Using

End Sub

End Class


|||

Default SQL Server port is 1433 which is not opened so it's not going to work until your SQL Server is properly configured. Also you have to provide credential in connection string, this string is not going to work.

I'm moving this thread to appropriate forum.

|||

Hi,

Thanks for your answer, and right now 1433 port is open. I would like to use windows authentication protocol. Could you please provide a sample for the connection string? Thanks a lot.

|||

Hi,

Thanks for your answer, and right now 1433 port is open. I would like to use windows authentication protocol. Could you please provide a sample for the connection string? Thanks a lot.

|||

This should work:

"Server=YourServerHere,1433;Initial Catalog=YourDataBaseHere;User ID=YourLoginHere;Password=YourPasswordHere;Integrated Security=SSPI;"

Note you have to provide login and password even though windows authentication will be used. That's because there's no login procedure on devices.

|||

Dear Ilya Tumanov,

Thanks a lot for your so many helps, and it works.

|||

so..It must have a password?is it same with windows user's password?what if blank?

if I'm not wrong, if we set the windows password, we should change the SQL password too right?

|||

you should check this link http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=709129&SiteID=1&mode=1

It works for me after a loooooonggg time testing

Thursday, March 8, 2012

Can I write a dll(or share the same code) that works on both Mobile device and pc?

hi,

Can I write a dll(or share the same code) that works on both Mobile device and pc? Since we are using compact edition, we are hoping we can write some common module with the same code that could works on both mobile device and pc platform. I noticed the reference is the same, System.Data.SqlServerCe.dll 3.0.

Another question is, we already have a module for SQLCE2.0, with .net CF1.0. Now, we will start to use compact edition, should we just update on the 1.0 one, or we have to write a different one based on .net CF2.0? Can I use compact edition in CF1.0 dll?

Thanks.

The code in terms of SQL CE is exactly the same, apart from the connection string. So yes, you can easily share code, you will have to use 2 different solutions to target the different platforms, however. SQL CE/SQL Mobile is only available in Visual Studio 2005.

Friday, February 10, 2012

Can I install SQL mobile on Storage Card ?

Hi,

SQL mobile apps like - .Net Frame work, SQLCE mobile etc - can they be install on the Storage Card? I am running out of space on my Verizon 6700 and don't have enought memory to install on the device. I cleaned up as much as I could still not enough space on the device.

Can this be done?

Thanks,

P

All my Windows Mobile 5 devices have SQL Compact Edition installed on the storage card. When you execute the installation cab files, you will be asked if you want to put the file on main storage or on the card.|||

Hi,

Are you talking about .NET Frame work, SQLcesa mobile files? There are 4 SQL mobile files that I need to install. Can they all be installed on Storage Card?

Thanks,

P

|||

After looking at my K-Jam's storage card, under the \Windows directory I found the following files:

sqlceca30.dll

sqlcecompact30.dll

sqlceoledb30.dll

sqlceqp30.dll

sqlcese30.dll

Hope this helps.

(I just noticed that this device also has another installation on the main storage. Cleanup!)

|||

Thanks for the help, but I still don't know if this answers my question. As far as I know - I always thought that SQL mobile files were supposed to be installed the device. The DB can reside on Storage Card but the the mobile files.

Anyone else has a comment?

P

|||

Both .NET CF 2.0 SP2 and SQL Compact 3.1 can be installed to a storage card. As Joao mentions, you are simply prompted during install, and given the option to install to either the device or the storage card.

|||After making sure that I only have one installation of SQL Compact Edition 3.1 on my device's storage card (with exactly the same files as I reported previously), I can confirm that the engine does work.