Sunday, March 11, 2012
connection from windows mobile 5.0
I have written some software for a windows mobile 5.0 device that
connects to a sql server directly and performs various operations
against a database.
Under sql server 2000 and XP, I had no problems doing this using
ActiveSync and/or via wireless tcp connections with a vpn connection
to the desktop.
However, since I switched to MS Vista and SQL Server 2005 (Developers
Edition), I can only connect while using Mobile Device Center
(ActiveSync).
What's confusing to me is that when I am connected wirelessly using a
VPN connection to the Vista machine, I'm on the same subnet as the
desktop/SQL Server. While using ActiveSync (MDC), I'm on a completely
different subnet. SQL Server connections function fine through
ActiveSync, but not over the VPN.
How do I configure SQL Server to allow these wireless/vpn connections?
Is this even a SQL Server setting?
Thanks for any and all help.
Charlie
Ok. I figured it out. My device is not resolving the host name
correctly. I configured the connection string to use the IP address
and it connects fine.
Thanks,
Charlie
connection from windows mobile 5.0
I have written some software for a windows mobile 5.0 device that
connects to a sql server directly and performs various operations
against a database.
Under sql server 2000 and XP, I had no problems doing this using
ActiveSync and/or via wireless tcp connections with a vpn connection
to the desktop.
However, since I switched to MS Vista and SQL Server 2005 (Developers
Edition), I can only connect while using Mobile Device Center
(ActiveSync).
What's confusing to me is that when I am connected wirelessly using a
VPN connection to the Vista machine, I'm on the same subnet as the
desktop/SQL Server. While using ActiveSync (MDC), I'm on a completely
different subnet. SQL Server connections function fine through
ActiveSync, but not over the VPN.
How do I configure SQL Server to allow these wireless/vpn connections?
Is this even a SQL Server setting?
Thanks for any and all help.
CharlieOk. I figured it out. My device is not resolving the host name
correctly. I configured the connection string to use the IP address
and it connects fine.
Thanks,
Charlie
Saturday, February 25, 2012
Connection error in sql server compact edition 2005
i m working on device application ..i m using sql server ce 2005 with c#.net ... but when i m trying to connect to database it shows me error that
"the database path not found ... please check the path [,,,filename,,,]"
my code is as below
private string ConnStr = "Data Source =\\My Documents\\Employee.sdf;";
private void cmdCheckConnecton_Click(object sender, EventArgs e)
{
try
{
cn = new System.Data.SqlServerCe.SqlCeConnection(ConnStr);
cn.Open();
MessageBox.Show(cn.State.ToString());
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
i have my database in My Documents and the path is right still it shows the error
pls help if any one have a solution regarding this problem
thanxx
Zalak Shah
This is just a guess, but looking at my connection strings they have quotes around the Data Source, so maybe try adding those in.
private string ConnStr = "Data Source =\"\\My Documents\\Employee.sdf\";";
|||hii have done it but still it doesn't work
one more thing i want to tell u .. if i create the database on the same location even it is there it will create once again and no files will be create at that location that 's just a file in a memory .... and after that that memory file will accessed by that code and working perfectly as i needed
can u tell me one thing that location is in mobile device (Emulator) 's location or my hard drive's location
Connection error in sql server compact edition 2005
i m working on device application ..i m using sql server ce 2005 with c#.net ... but when i m trying to connect to database it shows me error that
"the database path not found ... please check the path [,,,filename,,,]"
my code is as below
private string ConnStr = "Data Source =\\My Documents\\Employee.sdf;";
private void cmdCheckConnecton_Click(object sender, EventArgs e)
{
try
{
cn = new System.Data.SqlServerCe.SqlCeConnection(ConnStr);
cn.Open();
MessageBox.Show(cn.State.ToString());
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
i have my database in My Documents and the path is right still it shows the error
pls help if any one have a solution regarding this problem
thanxx
Zalak Shah
This is just a guess, but looking at my connection strings they have quotes around the Data Source, so maybe try adding those in.
private string ConnStr = "Data Source =\"\\My Documents\\Employee.sdf\";";
|||hii have done it but still it doesn't work
one more thing i want to tell u .. if i create the database on the same location even it is there it will create once again and no files will be create at that location that 's just a file in a memory .... and after that that memory file will accessed by that code and working perfectly as i needed
can u tell me one thing that location is in mobile device (Emulator) 's location or my hard drive's location
Friday, February 17, 2012
Connecting WinCE app directly to SQL Server
halls. We use SQL Server (2000K) as the backend. The gaming device
software is a Windows CE application written in C/C++. We do not use any
framework as we needed maximum graphics speed to spin reels and do other
animations so that rules out the usual way to connect CE to SQL Server. We
currently use a product called CEFusion that provides us with an ADO
interface to SQL server but it is overkill for what we need and has a high
per client cost.
We are thinking about writing our own SQL client software, and have
sufficient programming skills to do it, but we don't know if that is
something Microsoft allows or if they would release the information needed
to do it. Is this possible? Are there any other solutions?
Hi
ADOCE is you option. No matter what, you need to use some form of OLE
DB/ODBC layer, as MS does not publish the wire protocol spec for TDS.
Look at:
http://msdn.microsoft.com/library/de.../ppc_eplus.asp
http://search.microsoft.com/search/r...=4&s=1&swc= 4
Regards
Mike
"Harold Rappold" wrote:
> We are developing a portable gaming device for use in casinos and bingo
> halls. We use SQL Server (2000K) as the backend. The gaming device
> software is a Windows CE application written in C/C++. We do not use any
> framework as we needed maximum graphics speed to spin reels and do other
> animations so that rules out the usual way to connect CE to SQL Server. We
> currently use a product called CEFusion that provides us with an ADO
> interface to SQL server but it is overkill for what we need and has a high
> per client cost.
> We are thinking about writing our own SQL client software, and have
> sufficient programming skills to do it, but we don't know if that is
> something Microsoft allows or if they would release the information needed
> to do it. Is this possible? Are there any other solutions?
>
>
Sunday, February 12, 2012
connecting to sql server from mobile device
How can I connect to sql server from a mobile device?
the server is on pc and my app is on the device.
I want to perform commands and stored procedures which will be performed online on the pc and get immediate results.
is there any way of achiving that?
Once this is done its the same as if you were connecting to sqlserver on the full framework with ASP.net or VB.net
here is some sample code
Imports System.Data.Common
Imports System.Data.SqlClient
Private m_connString As String = "user id=sa;password=;initial catalog=Northwind;Server=xxx.xxx.xxx.xxx;"
Private m_ds As New DataSet
Dim l_sqlConn As SqlConnection
Dim l_da As DataAdapter
Dim l_ds As DataSet
Dim l_sqlStmt As String
Try
l_sqlConn = New SqlConnection(m_connString)
l_sqlConn.Open()
l_sqlStmt = "SELECT * FROM tbl_Users ORDER BY FullName"
l_da = New SqlDataAdapter(l_sqlStmt, l_sqlConn)
m_ds = New DataSet
l_da.Fill(m_ds)
Catch ex As SqlException
Dim l_sqlerr As SqlError
For Each l_sqlerr In ex.Errors
MsgBox(l_sqlerr.Message)
Next
Finally
If l_sqlConn.State = ConnectionState.Open Then
l_sqlConn.Close()
l_sqlConn = Nothing
End If
End Try
Dim l_cmd As SqlCommand = l_sqlConn.CreateCommand()
l_cmd.CommandType = CommandType.StoredProcedure
l_cmd.CommandText = "<Stored Procedure Name>"
l_cmd.Parameters.Add(New SqlParameter("UnitOutDate", SqlDbType.DateTime))
l_cmd.Parameters("UnitOutDate").Value = Date.Now
l_cmd.executeNonQuery()
when i try to open the connection i get a "PlatformNotSupportedException"
is there any reason that exception could appears?|||on the emulator or on the device|||
let me specify a little:
I have a device which has a microsoft windows ce .net version 4.2 system.
i try to connect it to sqlserver 2000 that is on a pc server(win 2000 for servers). I create SqlConnect object on the device with the connection string
"Persist Security Info=False;Integrated Security=false; database=northwind; server=xxx.xxx.xxx.xxx; Connect Timeout=30; User ID=testing; Password=test;"
so far so good, but when i perform the function Open(on the device itself), I get the "PlatformNotSupportedException".
and i just cannot figure out why.
Try testing it on the emulator and see if you get the same error|||
That usually means DB collation you're using is not supported on particular device. You can change collation of this DB or get localized device which supports locale you’re using.
I created another database on the same server and gave it's collation Latin1_General_CI_AS and tried again and it worked :-)
which brings me to this question:
is there any way to tell the connection object what the database collation is? because I dont think i'm allowed to convert the database to Latin1_General_CI_AS collation.
or any other way to solve this mess...|||you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp
-Darren Shaffer
.NET Compact Framework MVP|||
Darren Shaffer wrote:
you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp-Darren Shaffer
.NET Compact Framework MVP
I have this same problem (platformnotsupported) and I don't understand your answer. Problem is with SqlConnection and you say that we must add locale identifier in connection string to SqlCeConnection?
|||
As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:
1. Change database collation to something which is supported on device.
2. Get device which supports your database collation.
|||
Ilya Tumanov wrote:
As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:
1. Change database collation to something which is supported on device.
2. Get device which supports your database collation.
I know
Ad 1. No, i can't change collation of my database.
Ad.2. I can't get device which support my database collation (it is Symbol MC9090 with Win CE 5.0 and my database have Polish_CI_AS collation). Works great when I change colllation to Latin1_general but i can't do this with my main database.
Is there an other option? I try RDA but problem with charsets exists, Polish chars ? ? ? ń etc. changes to strange symbols, its useless.
connecting to sql server from mobile device
How can I connect to sql server from a mobile device?
the server is on pc and my app is on the device.
I want to perform commands and stored procedures which will be performed online on the pc and get immediate results.
is there any way of achiving that?
Once this is done its the same as if you were connecting to sqlserver on the full framework with ASP.net or VB.net
here is some sample code
Imports System.Data.Common
Imports System.Data.SqlClient
Private m_connString As String = "user id=sa;password=;initial catalog=Northwind;Server=xxx.xxx.xxx.xxx;"
Private m_ds As New DataSet
Dim l_sqlConn As SqlConnection
Dim l_da As DataAdapter
Dim l_ds As DataSet
Dim l_sqlStmt As String
Try
l_sqlConn = New SqlConnection(m_connString)
l_sqlConn.Open()
l_sqlStmt = "SELECT * FROM tbl_Users ORDER BY FullName"
l_da = New SqlDataAdapter(l_sqlStmt, l_sqlConn)
m_ds = New DataSet
l_da.Fill(m_ds)
Catch ex As SqlException
Dim l_sqlerr As SqlError
For Each l_sqlerr In ex.Errors
MsgBox(l_sqlerr.Message)
Next
Finally
If l_sqlConn.State = ConnectionState.Open Then
l_sqlConn.Close()
l_sqlConn = Nothing
End If
End Try
Dim l_cmd As SqlCommand = l_sqlConn.CreateCommand()
l_cmd.CommandType = CommandType.StoredProcedure
l_cmd.CommandText = "<Stored Procedure Name>"
l_cmd.Parameters.Add(New SqlParameter("UnitOutDate", SqlDbType.DateTime))
l_cmd.Parameters("UnitOutDate").Value = Date.Now
l_cmd.executeNonQuery()
when i try to open the connection i get a "PlatformNotSupportedException"
is there any reason that exception could appears?|||on the emulator or on the device|||
let me specify a little:
I have a device which has a microsoft windows ce .net version 4.2 system.
i try to connect it to sqlserver 2000 that is on a pc server(win 2000 for servers). I create SqlConnect object on the device with the connection string
"Persist Security Info=False;Integrated Security=false; database=northwind; server=xxx.xxx.xxx.xxx; Connect Timeout=30; User ID=testing; Password=test;"
so far so good, but when i perform the function Open(on the device itself), I get the "PlatformNotSupportedException".
and i just cannot figure out why.
Try testing it on the emulator and see if you get the same error
|||
That usually means DB collation you're using is not supported on particular device. You can change collation of this DB or get localized device which supports locale you’re using.
I created another database on the same server and gave it's collation Latin1_General_CI_AS and tried again and it worked :-)
which brings me to this question:
is there any way to tell the connection object what the database collation is? because I dont think i'm allowed to convert the database to Latin1_General_CI_AS collation.
or any other way to solve this mess...|||you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp
-Darren Shaffer
.NET Compact Framework MVP|||
Darren Shaffer wrote:
you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp-Darren Shaffer
.NET Compact Framework MVP
I have this same problem (platformnotsupported) and I don't understand your answer. Problem is with SqlConnection and you say that we must add locale identifier in connection string to SqlCeConnection?|||
As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:
1. Change database collation to something which is supported on device.
2. Get device which supports your database collation.
|||
Ilya Tumanov wrote:
As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:
1. Change database collation to something which is supported on device.
2. Get device which supports your database collation.
I know
Ad 1. No, i can't change collation of my database.
Ad.2. I can't get device which support my database collation (it is Symbol MC9090 with Win CE 5.0 and my database have Polish_CI_AS collation). Works great when I change colllation to Latin1_general but i can't do this with my main database.
Is there an other option? I try RDA but problem with charsets exists, Polish chars ? ? ? ń etc. changes to strange symbols, its useless.