rgatiganti
asked on
When to use SQLCE and SQL server
Hi,
I have a SQL server database and I am developing windows mobile application. I want to query sql server database on my desktop from my mobile application. In this case should I use sqlceconnection or sqlconnection. Which one is correct ?
I am new to sql database and I am totally confused. Please help with this.
Thank you,
Divya.
I have a SQL server database and I am developing windows mobile application. I want to query sql server database on my desktop from my mobile application. In this case should I use sqlceconnection or sqlconnection. Which one is correct ?
I am new to sql database and I am totally confused. Please help with this.
Thank you,
Divya.
ASKER
Hello,
Thank you for the quick reply. I have 4 tables on my server. I want to have the same tables on my mobile as well. But I dont need to use sync because I dont need to get all the information once. Every time I will query the server and get my information. If the information is needed i will add that to my mobile database.
So, I will not use any sync service here.
So, to do this I need to write code to access my mobile database (.sdf) as well database on server(.mdf files). So, are saying I can use sqlceconnection to access mobile database and sqlconnection to access server database from mobile. In that case I need to install sql server on my mobile right? Is that possible.
Thank you,
Divya.
Thank you for the quick reply. I have 4 tables on my server. I want to have the same tables on my mobile as well. But I dont need to use sync because I dont need to get all the information once. Every time I will query the server and get my information. If the information is needed i will add that to my mobile database.
So, I will not use any sync service here.
So, to do this I need to write code to access my mobile database (.sdf) as well database on server(.mdf files). So, are saying I can use sqlceconnection to access mobile database and sqlconnection to access server database from mobile. In that case I need to install sql server on my mobile right? Is that possible.
Thank you,
Divya.
Divya,
NO you cannot install SQL Server into your mobile device :)
I'm assuming you have already installed SQL Server Compact Edition in your mobile device though.
Next in your application,add a reference to system.data.sqlclient (by right clicking your project and going to ADD Reference)
Then you can now add an Imports statement ...
imports system.data.sqlclient
c#
using syste,data.sqlclient
From there you can write the connection string to conenct to the database in your PC -for example
Dim conn as new sqlconnection("Data Source=myServerAddress;Ini tial Catalog=myDataBase;Integra ted Security=SSPI;")
Hope that helps.
Norman Maina
NO you cannot install SQL Server into your mobile device :)
I'm assuming you have already installed SQL Server Compact Edition in your mobile device though.
Next in your application,add a reference to system.data.sqlclient (by right clicking your project and going to ADD Reference)
Then you can now add an Imports statement ...
imports system.data.sqlclient
c#
using syste,data.sqlclient
From there you can write the connection string to conenct to the database in your PC -for example
Dim conn as new sqlconnection("Data Source=myServerAddress;Ini
Hope that helps.
Norman Maina
ASKER
Ok, thank you. I followed the steps you mentioned. I tried to connect to my server database. When I say conn.Connect() I am getting SqlException which says General Network Error.
Can you help me with this error.
Thank you,
Divya.
Can you help me with this error.
Thank you,
Divya.
And to quote the Microsoft guy
"This should work:
"Server=YourServerHere,143 3;Initial Catalog=YourDataBaseHere;U ser ID=YourLoginHere;Password= YourPasswo rdHere;Int egrated 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."
"This should work:
"Server=YourServerHere,143
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."
ASKER
Thank you. I am going through the links provided to get the solution. I just have two more questions.
1) Do I need to have IIS running on my server? I just have SQL server 2008 installed on my server.
2) How should i open TCP port on my server?
Thank you,
Divya.
1) Do I need to have IIS running on my server? I just have SQL server 2008 installed on my server.
2) How should i open TCP port on my server?
Thank you,
Divya.
ASKER
Hi,
I am still not able to connect. I am able to access network using IE browser. But I am not able to ping the server using vxUtils. Please help me here.
Thank you,
Divya.
I am still not able to connect. I am able to access network using IE browser. But I am not able to ping the server using vxUtils. Please help me here.
Thank you,
Divya.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
To query the sql server in your PC - you should use sqlconnection.
The usual development for mobile apps using windows mobile is to have a subset of the main database in your phone -which your application will connect(sqlceconnection ) and then sync back the changes when ready with the database in your PC or LAN.
rgds,
Norman Maina