Showing posts with label device. Show all posts
Showing posts with label device. 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.

Tuesday, February 14, 2012

can i pull data from a sql server express 2005 db onto my ce device?

Will my 'smart device application' designed with VS.Net 2005 allow my ce
device to pull data from a SQL Server EXPRESS 2005 database residing on the
server computer? Or must I be using the full version of SQL Server 2005 to
accomplish this movement of data between my ce device and my server
computer?
Thanks!
hi Jesse,
Jesse Aufiero wrote:
> Will my 'smart device application' designed with VS.Net 2005 allow my
> ce device to pull data from a SQL Server EXPRESS 2005 database
> residing on the server computer? Or must I be using the full version
> of SQL Server 2005 to accomplish this movement of data between my ce
> device and my server computer?
>
i you mean, for instance, querying a SQLExpress instance via (say) wi-fi
connected CE devices, then yes.. just verify the SQLExpress instances allows
remote connections..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply
|||thanks, i need to know specifically if a vs.net 2005 smart device
application can issue an RDA pull method (like i was able to do with vs.net
2003) to a sql server express 2005 database residing on a remote server
computer.
i'm actually hoping that someone can answer the question or point me to an
article so that i don't have to go through extensive r&d to determine if it
can be done. normally i would be more than happy to do this r&d, however,
to answer this seemingly simple question would require that i purchase and
install vs.net 2005, install sql server express 2005, learn how to use them,
write test applications, install the test applications to devices, etc.
before i go down this expensive and arduous road, i figured maybe someone
might know the answer off the top of their head. ah, the beauty of
newsgroups!
thank you
"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:42i54eF1jj877U1@.individual.net...
> hi Jesse,
> Jesse Aufiero wrote:
> i you mean, for instance, querying a SQLExpress instance via (say) wi-fi
> connected CE devices, then yes.. just verify the SQLExpress instances
> allows remote connections..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
> DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
> (my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
> interface)
> -- remove DMO to reply
>