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
sql
No comments:
Post a Comment