I\'ve connected my Motorola MC3090R having Windows CE 5 through cradle (Windows Mobile Device Center) with my laptop having Windows 7 (there is no network), my question is t
private void form1Load(Object sender, EventArgs e)
{
String strConnection =
"Data Source=your_ip;Initial Catalog=your_database;Integrated Security=True; User ID=your_db_user;Password=your_db_password;";
try
{
conn = new SqlConnection(strConnection);
conn.Open();
MessageBox.Show("You Success!!");
}
catch (SqlException ex)
{
MessageBox.Show("You failed!" + ex.Message);
conn.Close();
}
}
When you say "connected through cradle" I assume you are using Active Sync on the device. If that is the case, you will have a dynamic IP address assigned to your connection, in answers to this question you will find how to retrieve this address so that you can use it to build the connection string.
If I understand your setup
PDA -> PC ->Sql Server(Remote).
If that's the setup you can configure via the Windows Mobile Device Center.
I solved it with this connection string.
m_Desktopconn = New SqlConnection(
"Data Source=192.168.55.100,1433;Initial Catalog=Testing;Persist Security Info=True;User ID=sa;Password=sa;")
I had two instances MYPC\SQL2005 & MYPC\SQL2008, and then installed SQL 2005 Express on MYPC (Without instance)