ASP Net starter pack - MSSQL Server problems so can't finsih tutorials.

D

Dave Smithz

Hello There,

I'm learning ASP.net from a visual basic ground. I obtained the ASP.net
resource kit from Microsoft which has some tutorials. However I have become
stuck with the setup of Windows Server 2000.
When I try and run lab 3 which is supposed to talk to the Nrthwind Database
I get the following error:

"Server Error in '/Lab3-CS-Starter' Application.

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection."

What can I do to resolve this. I did first install the MSDE for web matrix
and now when I Start my Laptop it MSSQL service manager seems to be running
on my task bar and telling me that SQL Server is running.


It failes when running the following

public class LoginDemo : System.Web.UI.Page
{
private SqlConnection myConnection;
protected System.Web.UI.WebControls.DataGrid dgProducts;
protected System.Web.UI.WebControls.Label lblUserID;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
// Create a connection to the Northwind database
myConnection = new SqlConnection("server=(local);database=Northwind;User
ID=sa;password=passwordIsetviacmdLine");
if (!Page.IsPostBack)
{
//Server side State management using Session
lblUserID.Text = lblUserID.Text+" "+ Session["UserID"];
BindGrid("ProductID");
}
}
public void BindGrid(string sortfield)
{
//Create DataAdapter to fetch data from Prodcuts table
SqlDataAdapter myCommand = new SqlDataAdapter("select * from Products",
myConnection);
//Create dataset and fill it with Product data
DataSet ds = new DataSet();
myCommand.Fill(ds, "Products");
//Bind Product data to Datagrid
DataView Source = ds.Tables["Products"].DefaultView;
Source.Sort = sortfield;
dgProducts.DataSource = Source;
dgProducts.DataBind();
}

#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.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}

If anyone can help then I would be greatful. IT seems that I have to read a
huge book in MSSQL Server before I can get into ASP and I just want to get
moving with ASP.net.

Thanks in advance.

Kind regards

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top