Wrox Programmer Forums
|
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 12th, 2007, 05:37 PM
Authorized User
 
Join Date: Jul 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default Assembly Reference Problem

Hi and thanks for taking a second. I am trying to bind the text property of a label to a datareader in codebehind. VS keeps telling me I am missing assembly references but I believe they are all there . (See the using directives below) I keep getting errors such as the following:

Error 1 The type or namespace name 'SQLDataReader' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\JasonLivengood\BeatlesDetails.aspx.c s 27 9 C:\...\JasonLivengood

Error 3 'System.Configuration.ConfigurationSettings.AppSet tings' is a 'property' but is used like a 'method' C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\JasonLivengood\BeatlesDetails.aspx.c s 28 54 C:\...\JasonLivengood

Error 4 The type or namespace name 'SQLConnection' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\JasonLivengood\BeatlesDetails.aspx.c s 29 9 C:\...\JasonLivengood

Error 8 The type or namespace name 'SQLCommand' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Jason Livengood\My Documents\Visual Studio 2005\WebSites\JasonLivengood\BeatlesDetails.aspx.c s 36 36 C:\...\JasonLivengood\


Any advice or help would be greatly appreciated. - Jason


 using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

using System.Data.Sql;

using System.Data.SqlTypes;



public partial class BeatlesDetails : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

BindLabel();

}

public void BindLabel()

{



int intID2;

SQLDataReader dtrAlbumn;

string strConnection = ConfigurationSettings.AppSettings("Beatles");

SQLConnection objCon = new SQLConnection(strConnection);

// Retrieve Albumn ID and Albumn pic ID

intID2 = Int32.Parse(Request.QueryString("id"));

//Get Albumn Name

SQLCommand cmdSelect = new SQLCommand("usp_Retrieve_Albumn_Title", objCon);

cmdSelect.CommandType = CommandType.StoredProcedure;

cmdSelect.Parameters.Add("@ID", intID2);

objCon.Open();

dtrAlbumn = cmdSelect.ExecuteReader();

if (dtrAlbumn.Read)

{

lblAlbumn.Text = dtrAlbumn("title");

dtrAlbumn.Close();

objCon.Close();

}

}

}
[u]</u>

 
Old June 12th, 2007, 09:13 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

SQL isn't capitalized, its SqlCommand, SqlConnection, etc.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
 
Old June 12th, 2007, 09:19 PM
Registered User
 
Join Date: Feb 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to condescendent Send a message via Yahoo to condescendent
Default

Does it matter if I use capitalized "SQLCommand" instead of "SqlCommand". Hope OP can give us an answer.

I am a database programmer and .Net programmer
 
Old June 13th, 2007, 03:16 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

As parsons said, the classes, methods, functions etc are case sensitive, so you cannot use them as you wish, in all caps or all lower. SqlCommand can't be used as SQLCommand.

Regards
Mike

Don't expect too much, too soon.
 
Old June 13th, 2007, 11:38 PM
Authorized User
 
Join Date: Jul 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks- Jason






Similar Threads
Thread Thread Starter Forum Replies Last Post
missing a using directive or an assembly reference zhshqzyc ASP.NET 2.0 Basics 3 January 13th, 2008 03:50 AM
problem in assembly salnavddin BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 8th, 2007 05:27 AM
problem with adding reference from 2.0 to 1.1 karthik_byk .NET Framework 2.0 1 May 11th, 2007 07:52 AM
inline assembly on VS2005 c++ PROBLEM Huskey C++ Programming 0 January 24th, 2007 10:58 AM
Object Reference Problem shaileshmark General .NET 3 July 22nd, 2004 04:13 PM





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