SQL Srver 2000

  • Hi,

    I am new here. I was looking for a forum to join cause ive installed SQL now and i guess soon i will tons of questions. hehe

    this is my first i guess:

    I am running windows XP Pro SP 2. i have Microsoft VisStudio .NET 2003 fully installed and now im installing SQL Server 2000 Developrs Edition. I just cimpleted the installaion and picked some settings:

    Local Computer Installation, Create new Instance since this is the first time i use it, Server and Client Tools, and chose a Local rather the Domain option aferwards. (i have used this version before but had to format the comp so now reinstalling everything).

    My problem is this, i basically started the server and it on online. i went to the "enterprise manager" and in the "Microsoft SQL Servers -> SQWL Server Group -> (Local)(Windows NT)-> Databases, i created a new database called tables and added a single table just to begin testing to see if at least its functional. i was able to do this so far.

    Now i started my .NET, and wrote a tiny program to see if the connection to the SQL database would open, but it didnt. It always failed. i am programming an ASP.NET WebApplication. I cant open the connection to my database. i dont know why. (The tiny piece of code i wrote is at the bottom in case you know c#). There is a note also under the code for the ones who will read through its simlicity

    any help or walk through would be appreciated. thank u...

    Sam

     

     

     

    CODE:

    using

    System;

    using

    System.Collections;

    using

    System.ComponentModel;

    using

    System.Data;

    using

    System.Drawing;

    using

    System.Web;

    using

    System.Web.SessionState;

    using

    System.Web.UI;

    using

    System.Web.UI.WebControls;

    using

    System.Web.UI.HtmlControls;

    using

    System.Data.SqlClient;

    using

    System.Configuration;

    namespace

    WebTest1

    {

    /// <summary>

    /// Summary description for WebForm1.

    /// </summary>

    public class WebForm1 : System.Web.UI.Page

    {

    string connection = ConfigurationSettings.AppSettings["ConnectionString"];

     

     

    protected System.Web.UI.WebControls.TextBox TextBox1;

    protected System.Web.UI.WebControls.Label Label1;

    protected System.Web.UI.WebControls.TextBox TextBox2;

    protected System.Web.UI.WebControls.Label Label2;

    protected System.Web.UI.WebControls.TextBox TextBox3;

    protected System.Web.UI.WebControls.Button Button1;

    protected System.Web.UI.WebControls.Label Label5;

    protected System.Web.UI.WebControls.Label outputBox;

    protected System.Web.UI.WebControls.Label Label3;

    private void Page_Load(object sender, System.EventArgs e)

    {

    // Put user code to initialize the page here

    }

    #region

    Web Form Designer generated code

    override protected void OnInit(EventArgs e)

    {

    //

    // CODEGEN: This call is required by the ASP.NET Web Form Designer.

    //

    InitializeComponent();

    base.OnInit(e);

    }

    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private void InitializeComponent()

    {

    this.Button1.Click += new System.EventHandler(this.Button1_Click);

    this.Load += new System.EventHandler(this.Page_Load);

    }

    #endregion

    private void Button1_Click(object sender, System.EventArgs e)

    {

    outputBox.Text = "Button has been clicked";

    SqlConnection conn =

    new SqlConnection(connection);

    outputBox.Text += "----------------Creating sql Connection";

     

    try

    {

    conn.Open();

    outputBox.Text += "---------------opening the Connection";

    }

    catch(Exception p)

    {

    outputBox.Text += "--------------failed to open Connection";

    Console.WriteLine(p.ToString());

    }

    outputBox.Text += "-------------Success Connection and Login to Server!";

     

    }

    }

    }

     

     

    NOTE: i always get this output :

    Button has been clicked----------------Creating sql Connection--------------failed to open Connection-------------Success Connection and Login to Server!

    it skips the try block's print line which means it didnt work......

     

    string connection = ConfigurationSettings.AppSettings["ConnectionString"]; this one i updated in my Web.config and included application setting line that loox like this

    <

    add key="ConnectionString" value="Data Source=127.0.0.1; Initial Catalog=login; User Id=sa; password=pass" />

     

  • Is your sql server set up to only allow Windows authentication, or Windows and SQL authentication?

  • wat you said is completely true Jo....

    i called up a friend, he told me the same thing... i reinstalled and got it fixed... thnx !!!

     

    Sam

  • Just a short additional note.

    You dont have to reinstall to change from Windows Authentication to Windows and SQL Authentication.

    You can access this property in either the registry[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\LoginMode] or through EM (Enterprise Manager) in the server properties section.  After changing this property, you will have to restart the Sql Server Service.

     

    Steve

  • oh nice!!

     

    so in the registry where it is set to 0x000000002 (1), i should change the REG_DWORD to (2) correct????

  • Samer,

    You can ask here every question if you think it can save you some work. Another source of help is under Start-Programs-Microsoft SQL Server -Books Online for SQL Server 2000 Books Online is like a help file where you can search by keywords or by index. For example your question: Open Books Online, click on Index tab, enter the word Authentication in the keyword box and select SQL Server Authentication Mode under Authentication in the list below. Click on the entry you just selected and if it prompts you to select the topic  in the Topic Found box, chose Authentication Modes topic. Read it, it is just 1 page. Scroll down to the bottom. You will see linkks to the examples of how to chose or change authentication mode for both Windows or Mixed Authentication in both Enterprise Manager or SQL_DMO. Just click on Enterprise Manager links and it will tell you how to do it.

    Hope it helps,

    Yelena

     

    Regards,Yelena Varsha

  • i just didnt wanna touch my registry....

    take it easy man.... i dont like to edit and values in their without asking first.....

    thnx anyways....

     

    Sam

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply