Re: Dataset - Error

From: Me2 (r_at_r.com)
Date: 06/09/04


Date: Wed, 9 Jun 2004 11:44:54 -0400

This is not the last error or problem you will run into when doing the
exercise in the MS Press or other exam prep guides. You will have to start
putting your mind into developer mode, and dissecting the error messages,
and searching for an appropriate solution. If you want to become a
developer, you will do this every day of your life. So if being faced with
ambiguous error messages, and not having someone give you the answers to
everyday problems turns you off, then I suggest that you not waste any more
of your money trying to get .Net certification.

That said, lets look at what is going on.

You are getting the error:
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection

So looking at this we see that it is an error coming from SQL. Second, it
is a login event. Third the user your program is trying to logon with is
'null'.

Next we would look at the connection string, which is used to "login" to SQL
server. Your connection string is:
> Dim nC As SqlConnection = New SqlConnection("data source=SEAFS;initial
catalog=Northwind;integrated security=SSPI;persist security
info=False;workstation id=CHAKP;packet size=4096")

Where in this string does it specify the userid? It does not directly.
What is does specify in regards to the userid is the
"integratedsecurity=SSPI" portion of the connection string. This specifies
that you want to use windows IIS security to control access to the SQL
server. IIS uses the ASPNET account when accessing system resources, but
you must specify that you want your application to use impersonation. You
can accomplish this by placing this string in your .config file:
<identity impersonate="true" />

Of course, you must now grant rights to ASPNET account in SQL server in
order to connect and access SQL databases and other resources.

Instead of looking for someone else to pull your fat out of the fire you
could have gone to Microsoft's Knowledge base and searched for a solution,
which you can tailor to your own system context.

-- 
Ralph Page  MBA, CMBA, MCAD .Net, MCDBA 2000, MCSE 2000, CCNA
-------------------------------------------------------------------------
"Every man is born into the world to do something unique and something
distinctive,
 and if he or she does not do it, it will never be done."
-- Dr. Benjamin E. Mays
-------------------------------------------------------------------------
"Papri Chakravorty" <anonymous@discussions.microsoft.com> wrote in message
news:C11FEF15-450C-42A0-B88D-C8184E3EF908@microsoft.com...
> Hello Experts,
>
> Yesterday I was trying to just populate a datagrid with a dataset.
> I used the following code in the page load event after using connection,
adapter and data set
> in the design mode
>
>   Dim nC As SqlConnection = New SqlConnection("data source=SEAFS;initial
catalog=Northwind;integrated security=SSPI;persist security
info=False;workstation id=CHAKP;packet size=4096")
>         Dim selectCMD As SqlCommand = New SqlCommand("SELECT CustomerID,
CompanyName FROM Customers", nC)
>         selectCMD.CommandTimeout = 30
>         Dim DA As SqlDataAdapter = New SqlDataAdapter()
>         DA.SelectCommand = selectCMD
>
>         nC.Open()
>
>         Dim DS As DataSet = New DataSet()
>         DA.Fill(DS, "Products")
>
>         nC.Close()
>
> .When i tried to build and browse,
> it gave me the following error
>
> Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection
>
> Can you please let me know what is causing this?
>
> I cannot proceed with the following chapters unless I get this clear.
>
> Many thanks
> Papri Chakravorty


Relevant Pages

  • Re: Web and SQL Security
    ... Your connection string needs to be a low privileged account. ... SQL auth is never recommended, ... Therefore web app communicates with the SQL server using ...
    (microsoft.public.sqlserver.security)
  • Re: help with changing some code from mdb to adp
    ... At the end of this post is an example of an ADO connection string to a SQL ... Server database, and '' to the UNC path/name of your instance of SQL ... Windows, you can't create a new UDL file directly, but you can create a new, ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Win2.3k and dotnet. Urgent please
    ... Did you install MSDE as an instance? ... connection string, unless it is the default instance. ... ASP.NET application and MSDE installed on our Win2k dev server. ... Then I installed SQL server client tools only. ...
    (microsoft.public.inetserver.asp.general)
  • Re: User authentication
    ... Express 2005 and I am using the developer's edition of SQL Server 2005. ... Thus, if you have a named instance, you need to specify this. ... very same commandline submitted on the commandline instead of through ...
    (comp.databases.ms-sqlserver)
  • how to configure ms sql server 2k and windows server 2k in order to sql from remote computer (with v
    ... My local database (under ms sql server 2000, ... database using a connection string with the ADODB VB object. ...
    (microsoft.public.sqlserver.connect)