RE: Connet to SQL Server?
From: Cowboy (Gregory A. Beamer) - MVP (NoSpamMgbworld_at_comcast.netNoSpamM)
Date: 09/29/04
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: Bulk updating records/rows whilst STILL in DataSet?"
- Previous message: Cowboy (Gregory A. Beamer) - MVP: "RE: OleDbDataReader"
- In reply to: Welles: "RE: Connet to SQL Server?"
- Next in thread: Welles: "RE: Connet to SQL Server?"
- Reply: Welles: "RE: Connet to SQL Server?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Sep 2004 08:05:02 -0700
Mixed mode security works wonders. Good catch!
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Welles" wrote:
> I just figured out the problem... and the way to solve it is to go to
> Enterprise Manager, select server properties and on the Security tab change
> Authentication mode to 'SQL Server and Windows'.
>
>
> "Welles" wrote:
>
> > I am a newbie to both .Net and Sql Server and I am trying to access the
> > database by using the ADO.Net data reader. This is actually one of the
> > execises in a book that I am reading. However, when I run this program, there
> > is an error saying that "Login failed for user 'sa'. Reason: Not associated
> > with a trusted SQL Server connection." Are there some settings I have to
> > change in the Sql Server? Please help me!
> >
> > //--------------------------------------------------------------
> > using System;
> > using System.Data;
> > using System.Data.SqlClient;
> >
> > class MyApp
> > {
> > static void Main()
> > {
> > try{
> > SqlConnection conn = new
> > SqlConnection("server=localhost;uid=sa;pwd=;database=pubs");
> > conn.Open();
> >
> > SqlCommand comm = new SqlCommand("select * from titles", conn);
> > SqlDataReader reader = comm.ExecuteReader();
> >
> > while(reader.Read())
> > Console.WriteLine(reader.GetString(1));
> >
> > conn.Close();
> > }
> >
> > catch(Exception e){
> > Console.WriteLine(e.Message);
> > }
> > }
> > }
> >
> > //--------------------------------------------------------------
- Next message: Cowboy (Gregory A. Beamer) - MVP: "RE: Bulk updating records/rows whilst STILL in DataSet?"
- Previous message: Cowboy (Gregory A. Beamer) - MVP: "RE: OleDbDataReader"
- In reply to: Welles: "RE: Connet to SQL Server?"
- Next in thread: Welles: "RE: Connet to SQL Server?"
- Reply: Welles: "RE: Connet to SQL Server?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|