Last post May 19, 2015 07:14 PM by Qwerty92
Mar 28, 2011 10:03 AM|reena_jainy2k1|LINK
I am using mobile 5.0 pocket pc. i have developed one application and its running success fully. Now i want to fetch the data from remote server having sql sever 2008 or sql server 2005. here is the code for it
private void button1_Click(object sender, EventArgs e)
SqlConnection connection = new SqlConnection("Server=servername;Initial Catalog=dbname;User ID=username;Password=password;Integrated Security=false;");
SqlCommand command = connection.CreateCommand();
command.CommandText = "select top 1 id from empinfo";
label1.Text = command.ExecuteScalar().ToString();
catch (Exception ex)
But i am getting the error that
How to remove this error and how to fetch the data from remote server using sql server 2008 or sql server 2005
Please help me out
Mar 28, 2011 11:37 AM|roopeshreddy|LINK
Are u using emulator to test ur application. If yes, make sure, the emulator is connected to the interne, and try again.
Check the following link, for connecting the Windows Mobile emulator to internet.
Hope it helps u...
Mar 29, 2011 05:35 AM|reena_jainy2k1|LINK
Thanks for answering. Yes i am using emulator and i have checked that its connected with internet. because i am able to view the site in internet explorer in application device after debugging. but not able to get data from remote server
What steps i should take to do this
Jan 14, 2014 04:58 AM|cmurat|LINK
its been a while that you asked the question however I wanted to reply with my solution to guide others who has the same problem with me.
I was able to connect to internet with windows mobile emulator however I could not connect to sql server.
I changed the connection string with bellow and it worked for me;
SqlConnection connection = new SqlConnection("Server=serverIP,sqlServerPort;Initial Catalog=dbname;User ID=username;Password=password;Integrated Security=false;");
SqlConnection connection = new SqlConnection("Server=192.168.1.4,1433;Initial Catalog=dbname;User ID=username;Password=password;Integrated Security=false;");
May 19, 2015 07:14 PM|Qwerty92|LINK
CMURAT THANK'S For Your RESPONSE DUDDDDE !! You saved my life !!! It worked just fine after adding the port !!