Re: Opening a SQLExpress database (Desktop) from PocketPC
- From: "Arrow" <arrow201@xxxxxxxxxxx>
- Date: Thu, 8 Dec 2005 10:45:52 -0500
DOH !!!!! ..port...port...port ....cannot use computer name unless it's in
the hosts registry
(this app will do it in a friendly manner:
http://www.freewareppc.com/utilities/pockethosts.shtml )
but you also have to check SQLExpress configuration manager to find what
port it's running under
so for me \\MyServerName\SQLEXPRESS ...was using port 1137 ....maybe it's
better to set
a static port? ...sooooo..changing my connection string to "(@"Data
Source=192.168.1.2,1137;Initial....)
works :) ....question now is.... in the registry, hosts are stored at
HKLM\Comm\tcpip ...but is there a way to store
port as well ? ....if using the Hosts app i still have to specify the
port..... ie. "(@"Data Source=MyServerName,1137;Initial...)"
will work, but "(@"Data Source=MyServerName\SQLEXPRESS;Initial...)" will not
work .....thanks
"Arrow" <arrow201@xxxxxxxxxxx> wrote in message
news:dn70ul$a23$1@xxxxxxxxxxxxxxxxxxxxx
> WM5 / VS2005
>
> i can't even get a basic connection to my SQLExpress...!?!?
>
> environment:
> - SQL Server Express running on a Windows 2000 server (ip is 192.168.1.2),
> have TCP, Named Pipes, etc enabled
> - using XP Pro desktop and can communicate to SQL Express via SQL Server
> Management Studio Express with no problems
> (
> http://www.microsoft.com/downloads/details.aspx?FamilyId=82AFBD59-57A4-455E-A2D6-1D4C98D40F6E&displaylang=en )
>
> ...at this point i would think my network setup to Express is ok
>
> On my WM5 device (WiFi ip: 192.168.1.10), using C#, System.Data.SqlClient
>
> SqlConnection Conn = new SqlConnection(@
> "Data Source=\\MyServerName\SQLEXPRESS;Initial
> Catalog=MyTestDb;Integrated Security=false;User
> ID=sa;Password=MyPassword");
>
> Conn.Open();
>
> ...but my connection fails ??? emulator (i added "guest" accn't to SQL")
> and actual device fails ...i've tried using the ip instead,
> ie. "Data Source=192.168.1.2\SQLEXPRESS;..." included "\\" at the
> beginning, taking them out....not adding the "SQLEXPRESS"
> part...double checked the id/password ....everything i try fails~~~~~
> ...as mentioned i can access and look at "MyTestDb" tables
> from my XP client box with no probs .....any ideas ? ..thanks
>
>
> "Darren Shaffer" <darrenshaffer@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
> message news:eIta6Cf%23FHA.360@xxxxxxxxxxxxxxxxxxxxxxx
>> Paul,
>>
>> When you specify the AttachDBFileName in the Compact Framework
>> ADO.NET Provider, you must specify the Database keyword as well
>> (example - "Database=PaulsDB")
>>
>> The User Instance connection string keyword is not used with the
>> CF ADO.NET provider.
>>
>> A few things will get you in trouble with SQL Express. By default,
>> after install, it has ALL of it's connection protocols disabled. You
>> have
>> to manually go in and set the surface area configuration to allow remote
>> connections and specify the type of connection (TCP, Named Pipes, etc)
>>
>> Also make sure the Windows Guest account is enabled on your SQL Express
>> instance if you are trying to connect from the emulator.
>>
>> You should also verify that your mobile device or emulator can resolve
>> the server name or it's IP address to verify you have a valid network
>> path
>> to the server hosting SQL Express.
>>
>> Finally, please do not post the same question to more than one newsgroup.
>>
>> Either the Compact Framework or SQL CE newsgroup is the appropriate one
>> for this question.
>>
>> --
>> Darren Shaffer
>> .NET Compact Framework MVP
>> Principal Architect
>> Connected Innovation
>> www.connectedinnovation.com
>>
>>
>> "Paul Aspinall" <paul@xxxxxxxxxx> wrote in message
>> news:Ol3lf.140666$Es4.75738@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
>>> Hi
>>> Can anyone point me in the right direction....
>>> I'm trying to open a SQL Express 2005 DB, from my PocketPC, so that I
>>> can write some code to synchronize the data.
>>>
>>> Does anyone have any code to show this being done??
>>>
>>> I'm using System.Data.SqlClient but from the PocketPC.
>>>
>>> Any help appreciated.
>>>
>>> Thanks
>>>
>>> I'm trying:
>>>
>>> SqlConnection Conn = new SqlConnection(@"Data
>>> Source=\\desktopmachinename\SQLEXPRESS;AttachDbFilename=C:\dataname.mdf;Integrated
>>> Security=True;User Instance=True");
>>>
>>> SqlCommand CMD = new SqlCommand("nameofstoredprocedure", Conn);
>>>
>>> CMD.CommandType = CommandType.StoredProcedure;
>>>
>>> Conn.Open();
>>>
>>> SqlDataReader dr = CMD.ExecuteReader();
>>>
>>> dataGrid1.DataSource = dr;
>>>
>>>
>>
>>
>
>
.
- References:
- Prev by Date: Re: Problem running CF 2.0 on device
- Next by Date: SubmitSQL string limit
- Previous by thread: Re: Opening a SQLExpress database (Desktop) from PocketPC
- Next by thread: Re: Problem with creating new Subscription.
- Index(es):
Relevant Pages
|