Re: Call a stored proc. from a Smart Device.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sergey Bogdanov (sergey.bogdanov_at_gmail.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 08:25:22 +0200

If you want to use Integrated Security you must explicitly set User ID
and Password:

"Integrated Security=SSPI;User
ID=<domain>\<username>;Password=<password>;..."

also you may try use SQL Server Authentication:

"User ID=sa;Password=<your password>;Initial Catalog=Northwind;Data
Source=COMPUTER-CD9T4F;"

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com

SteveInBeloit wrote:
> Daniel,
> Thanks for advising me on right clicking and adding the reference. When I
> did that I was able to add the Imports statement. Thanks.
>
> I am still stuck. I have a VB .NET Smart Device project open. I added one
> button, and on the click event I added the following code:
>
> Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
> Dim myConnection As New SqlConnection("Initial Catalog=Northwind;" & _
> "Data Source=COMPUTER-CD9T4F;Integrated Security=SSPI;")
> Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
> myConnection.Open()
> Dim myReader As SqlDataReader
> myReader = myCommand.ExecuteReader()
> While myReader.Read()
> Console.WriteLine((myReader.GetInt32(0) & ", " &
> myReader.GetString(1)))
> End While
> myReader.Close()
> myConnection.Close()
>
> I'm pretty sure the connection is good, I wrote a Window Form app and cut
> the SqlConnection from that. When I deploy this to the CE emulator in VS
> .NET, and when I click the button, I get:
>
> An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred
> in System.Data.SqlClient.dll
>
> Additional information: SqlException
>
> I just can't seem to get this thing right. All I want to do is connect from
> a Smart Device app to the SQL server.
>
> Any thoughts?
>
> Thanks,
> Steve
>
> "Daniel Moth" wrote:
>
>
>>The Imports statement saves you from fully qualifying the classes of a
>>namespace. To actually use the namespaces/classes of an assembly you need to
>>reference the assembly they are in. Right click on references in solution
>>explorer and add SqlClient (like Bill suggested).
>>
>>Cheers
>>Daniel
>>--
>>http://www.danielmoth.com/Blog/
>>



Relevant Pages

  • Re: ADO/MDAC on Terminal Server
    ... XP database system to SQL Server 2000. ... front end is running on the Terminal Server. ... MDB file due to fixes and modifications, ... "missing reference" error as the MDB file opens up. ...
    (microsoft.public.data.ado)
  • Please explain loss of token between web server box and sql box
    ... relating to Integrated Security with Asp.Net IIS 5 and Sql Server 2k. ... The problem arises when endeavouring to use Integrated Security at all ... grant the group Sql Server access and rights to the relevant database. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Connecting to a sql server database
    ... You are trying to use integrated security in your app (as is shown in the ... line numbered code where the connection string is shown). ... sql server, hence integrated security fails. ... > causing the error message and what the correction for this. ...
    (microsoft.public.dotnet.general)
  • Re: Desktop SQL Server
    ... It's also hard to provide you with a better reference because you didn't ... uninstalled when the SQL server is installed. ... Server but, according to my reading on this, the Microsoft Jet Engine ... who runs an application that uses the SQL Server will have to uninstall ...
    (microsoft.public.access.externaldata)
  • Re: Active Directory and SQL Server Connection
    ... when you say that you intend to use integrated security, ... creating a WindowsIdentity and calling Impersonate on that. ... > Thanks Sahil, ... so they have access to the sql server. ...
    (microsoft.public.dotnet.framework.adonet)