fsumike
Wed Jan 26 08:55:06 CST 2005
Thanks Brian!
I was teaching myself how to connect using a book reference to the server
explore, will use code instead.
Mike
"Brian Brown" wrote:
> Hi,
>
> If you are using Standard Edition the Servers node is not available in the
> Server Explorer. I have posted a link below to the documentation stating
> this. However you can connect to a database via code. You should be able to
> plug in your information in the code that I provided to connect to the pubs
> database on your Sql Server. I have modified the sample for you with the
> information that you provided.
>
> I hope this helps.
> -----------------------------------
>
> //link to documentation - you should be able to find out everything you
> would like to know about Database connections and server explorer here
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxoriconnectingtodatasourceswithserverexplorer.asp?frame=true
>
> //Modified sample code
> //NOTE: the <> means put your values there...leave out the <> (e.g.
> <servername> = MyServer )
> using System.Data;
> using System.Data.SqlClient;
> ....
> string strConn = @"Data Source=Server1;Initial Catalog=pubs;User
> Id=<username>;Password=<password>;";
> SqlConnection conn = new SqlConnection(strConn);
> SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Authors",conn);
> DataSet ds = new DataSet();
> da.Fill(ds);
>