Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 24th, 2006, 05:00 PM
Registered User
 
Join Date: Jun 2006
Location: , , United Kingdom.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:11 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.