Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 24th, 2006, 05:00 PM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie having trouble. Please help!!!!!

I am trying to set up a ASP.NET web site for the first time. I am using MS Vicual Web Developer 2005 Express with SQL Server 2005 Express.

I have set up a very basic bit of code to test connection to the database but I keep getting the error:

Cannot open database "xxx" requested by the login. The login failed.
Login failed for user 'LOUNGE\Greg'.

My page at the moment contains a button which call the code below:

Dim strSelectUsers As String = "SELECT * FROM users"
        Dim strConnString As String = "data source=.\SQLEXPRESS; Initial Catalog=Hedgehog; Integrated Security=true; User Instance=true"
        Dim connDB As New Data.SqlClient.SqlConnection(strConnString)
        Dim daUsers As New Data.SqlClient.SqlDataAdapter(strSelectUsers, connDB)
        Dim dsUsers As New Data.DataSet()
        Dim dtUser As Data.DataTable
        Dim drNewUser As Data.DataRow
        Dim userDB As Data.SqlClient.SqlCommandBuilder = New Data.SqlClient.SqlCommandBuilder(daUsers)
        connDB.Open()
        daUsers.Fill(dsUsers, "dtUserTable")
        connDB.Close()
        dtUser = dsUsers.Tables("dtUserTable")
        Try
            drNewUser = dtUser.NewRow()
            drNewUser(0) = "Fred"
            drNewUser(1) = "Bloggs"
            dtUser.Rows.Add(drNewUser)
            Dim drModified As Data.DataRow() = dsUsers.Tables("dtUserTable").Select(Nothing, Nothing, Data.DataViewRowState.Added)
            connDB.Open()
            daUsers.Update(drModified)
        Catch ex As Exception
            MsgBox(ex.Message)
            Throw ex
        Finally
            connDB.Close()
        End Try

I have the database in the App_Data folder within the project.

I am assuming that the login being used to access the SQLEXPRESS engine is 'LOUNGE\Greg' and have made sure that is added with appropriate permissions using SQL Server Management Studio Express and have SQLEXPRESS listening on TCP and NP.

If anyone can give me an idea as to where I have gone wrong/missed something, your response would be greatfully received.

Greg





Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie jono BOOK: Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages ISBN: 978-0-470-12448-2 3 December 11th, 2007 03:36 PM
Newbie here jmac731976 HTML Code Clinic 13 August 29th, 2007 03:54 PM
C# newbie jazzcatone C# 1 November 29th, 2005 06:03 PM
Newbie Help Sayian General .NET 1 March 30th, 2005 02:30 PM
newbie help pcm ADO.NET 1 December 18th, 2003 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.