Re: Connet to SQL Server?
From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 09/30/04
- Next message: William \(Bill\) Vaughn: "Re: ExecuteNonQuery() says I have bad SQL"
- Previous message: Welles: "RE: Connet to SQL Server?"
- 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 17:27:40 -0700
I don't demonstrate, illustrate or show examples of bad practices. It's like
showing someone how to swim wearing body armor and a field pack. ;)
Too many people use examples in unintended ways. I try my darndest to always
use best practices... it's tough but I sleep better.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Welles" <Welles@discussions.microsoft.com> wrote in message
news:B32ACBAA-B382-4541-AEA6-1C61EFEB8C66@microsoft.com...
> No no no, it is just an exercise to demonstrate the classes in the
> System.Data namespace. Of cause, I agree with you that it is a terrible
> idea
> to develop using the SA account. :)
>
> "William (Bill) Vaughn" wrote:
>
>> I don't agree with the book you're reading. It's not a good idea to use
>> SQL
>> Server security and it's a terrible idea to develop using the SA account.
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Welles" <Welles@discussions.microsoft.com> wrote in message
>> news:9D799842-1167-4B0A-9800-4724DAFF0F0C@microsoft.com...
>> >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: William \(Bill\) Vaughn: "Re: ExecuteNonQuery() says I have bad SQL"
- Previous message: Welles: "RE: Connet to SQL Server?"
- 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
|