Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / December 2008

Tip: Looking for answers? Try searching our database.

How to Direct connect with ActiveSync

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MutlyP - 20 Nov 2008 16:53 GMT
I hope someone can help me on this one it is driving me crazy.
I have Mobile 6 device connected to my desktop computer through a wire ,(NOT
wireless, repeat NOT WIRELESS) useing ActiveSync.
What I need to do is have the device connect to the SQL Server 2000 database
that is on my intranet and download data from tables in that database to the
tables in the database that is on my device. I beleive it's called Direct
Connect. I can not find any example code on how to do this. On the net it's
all about wireless connections, or merge and replication, but I can't do
those because of my companies security policies.
Please help
Thank You
Matt
Paul G. Tobey [eMVP] - 20 Nov 2008 17:00 GMT
You should be able to treat the ActiveSync connection as a network
connection, like wired Ethernet (NOT WIRELESS ;-).  Have you tried this and
found a problem?  The code would be no different than the wireless code, of
course, since it's just a network.

Paul T.

>I hope someone can help me on this one it is driving me crazy.
> I have Mobile 6 device connected to my desktop computer through a wire
[quoted text clipped - 12 lines]
> Thank You
> Matt
MutlyP - 21 Nov 2008 00:24 GMT
Paul
Can you give me a link to some code samples in VB on how to do this?
Thanks
Matt

> You should be able to treat the ActiveSync connection as a network
> connection, like wired Ethernet (NOT WIRELESS ;-).  Have you tried this and
[quoted text clipped - 19 lines]
> > Thank You
> > Matt
Paul G. Tobey [eMVP] - 24 Nov 2008 19:53 GMT
Well, I don't write in VB.NET, but it seems to me that you'd use the
SqlConnection class, with a suitable connection string.  You're using a very
old version of SQL Server, older than I've ever used with a .NET Compact
Framework client, so I'm not sure that it will work (and I'm sure it won't
be supported, even if it does).  You also haven't told us what version of
the .NET Compact Framework you're going to put on the device, so there might
be some cavaets, depending on that.  Something roughly like this:

imports System.Data.SqlClient
...
sql = New SqlConnection("Data Source=<name or IP of SQL Server
machine>;Initial Catalog=<name of database>;User ID="<name of
user>";password="<password for user>";")
sql.Open()
...

Paul T.

> Paul
> Can you give me a link to some code samples in VB on how to do this?
[quoted text clipped - 29 lines]
>> > Thank You
>> > Matt
MutlyP - 01 Dec 2008 18:47 GMT
Paul
I have tried to connect to the Northwind data base that is on SQL 2000 using
Visual Studio 2008 and I keep getting the error "Server does not exist or
access is denied" I made sure that SQL was on port 1433 and turned off all my
firewalls and I am still getting the "Server does not exist or access is
denied"
Please help.
Thanks

> Well, I don't write in VB.NET, but it seems to me that you'd use the
> SqlConnection class, with a suitable connection string.  You're using a very
[quoted text clipped - 47 lines]
> >> > Thank You
> >> > Matt
Paul G. Tobey [eMVP] - 01 Dec 2008 19:01 GMT
Again, you're using really old stuff in combination with the newest stuff.
If you're trying to connect "from Visual Studio", you mean through the
Server Explorer?  I almost never use that, so I can't tell you what's going
on.  Read the help and verify that you can do that with that version of the
server from VS2008.  Maybe the server requires a user name and password and
you aren't giving it.  Maybe you're identifying the server you're trying to
connect to incorrectly (wrong name, wrong IP, wrong whatever).  Maybe the
server isn't set up to allow TCP/IP connections.

All I can tell you is that VS2008 works fine with SQL Server 2005 and so
does .NET CF 3.5 with the SQL CE client.  If you still want to try to get
this desktop-to-desktop connection working and can't, I'd suggest that you
ask about *that* in an SQL Server group.  That question has nothing to do
with SQL Server CE, does it?

Paul T.

> Paul
> I have tried to connect to the Northwind data base that is on SQL 2000
[quoted text clipped - 67 lines]
>> >> > Thank You
>> >> > Matt
MutlyP - 01 Dec 2008 19:37 GMT
Hi Paul
I am going to try this one last time and if you still think I am using old
stuff than I will no longer bother you.
I have one develope machine on that machine I have installed Microsoft SQL
Server 2000 (personal edition), Visual Studio 2008.
All I want to do is down load is the Country from the Customers table in the
Northwind database into a ComboBox. The ComboBox is on a Form in a Smart
Device Project in Visual Studio 2008.
(Opened Visual Studio 2008 clicked on Create Project. New Project window
opens I clicked on Smart Device and then choose Smart Device Project and .Net
Framework 3.5.)
In the Form1_Load I have this code:

Dim sConnection As String = "Data Source=(local);Initial
Catalog=Northwind;User ID=csInfo;Password=csInfo;"
       Dim sSQL As String = "SELECT DISTINCT Country FROM Customers ORDER
BY Country"
       Dim comm As SqlCommand = New SqlCommand(sSQL, New
SqlConnection(sConnection))
       Dim dr As SqlDataReader = Nothing
       Try
           comm.Connection.Open()
           dr = comm.ExecuteReader

           While dr.Read
               cboCountries.Items.Add(dr(0))

           End While
       Catch ex As Exception
           MessageBox.Show(ex.Message)
           Return
       End Try
       dr.Close()
       comm.Connection.Close()
   End Sub

I run this and get the "Can't find Server or Access Denied".
Like I said I made sure port 1433 is being used, I changed the name of the
server in the code to the IP address  and turned off both Firerwalls that are
on my computer.
If I run the exact same code in a regular projcet (Not a Smart Device
Project) it runs fine.
Again sorry if this should be in another form but you say that SQL Server
2000 is old but I read nothing that Visual Studio 2008 does not work with SQL
Server 2000. My web connections and desktop project connections to SQL Server
2000's databases. It's just the Smart Device.
Any ideas?
Thanks for all your help.
Matt

> Again, you're using really old stuff in combination with the newest stuff.
> If you're trying to connect "from Visual Studio", you mean through the
[quoted text clipped - 84 lines]
> >> >> > Thank You
> >> >> > Matt
Paul G. Tobey [eMVP] - 01 Dec 2008 20:43 GMT
That won't work because you have a connection string that can't be correct.
You're saying that the database is (local), but it's not; it's on your PC,
right?  Not on the Smart Device?  If you set the Data Source to something
reasonable, I don't see anything else wrong with it, but yes, you are using
a very old version of the SQL Server software.  I would also strongly
suspect that anything with "Personal Edition" in its name is not going to be
network-accessible.  It would probably work if you wrote a PC program to
access the database on the same machine, but your smart device is just like
another PC on the network.

Paul T.

> Hi Paul
> I am going to try this one last time and if you still think I am using old
[quoted text clipped - 154 lines]
>> >> >> > Thank You
>> >> >> > Matt
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.