Click here to Skip to main content
15,908,015 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Apply css stylesheet to asp.net pages Pin
Guffa16-Aug-06 10:12
Guffa16-Aug-06 10:12 
GeneralRe: Apply css stylesheet to asp.net pages Pin
eggsovereasy17-Aug-06 3:34
eggsovereasy17-Aug-06 3:34 
QuestionASP.NET TAB in IIS Pin
seee sharp16-Aug-06 7:31
seee sharp16-Aug-06 7:31 
AnswerRe: ASP.NET TAB in IIS Pin
Mike Ellison16-Aug-06 10:32
Mike Ellison16-Aug-06 10:32 
QuestionRe: ASP.NET TAB in IIS Pin
seee sharp17-Aug-06 2:53
seee sharp17-Aug-06 2:53 
Questionhelp me see where i did wrong pls Pin
neodeaths16-Aug-06 6:28
neodeaths16-Aug-06 6:28 
AnswerRe: help me see where i did wrong pls Pin
Jesse Squire16-Aug-06 6:40
Jesse Squire16-Aug-06 6:40 
AnswerRe: help me see where i did wrong pls Pin
Guffa16-Aug-06 7:21
Guffa16-Aug-06 7:21 
What is it that you are trying to do, really?

I have seldom seen a piece of code with so many errors... Wink | ;)

Let's have a look at your code:

comm.CommandText = "select distinct BrandID,Brand as PictureFileName" +
" and BrandID = @BrandID";


Why are you using distinct? Can there more than one record with the same BrandId?

You have forgotten the keyword "from" before the table name.

You are creating the alias "PictureFileName" for the table, but you are not using this alias anywhere.

You have forgotten the "where" keyword.

You have the operator "and", as if you were trying to combine conditions, but you only have one condition.

If you fix the query so that it works, it's still pointless. There are only two different results that you can get from it; either the exact same value that you put in the parameter if there is a matching record in the database, or an empty result if there is no matching record.

comm.Parameters.Add("@BrandID", BrandID);


Looking good. You might consider to specify the data type of the parameter once you get it up and running, though, to save a round trip to the database.

SqlDataReader dr10 = comm.ExecuteReader();


Nothing wrong here.

CatName.Text = dr10;


You can't put the entire DataReader object in the label. You have to read a value from the DataReader, perhaps using the GetInt32 method.

Before you try to read anything from the DataReader, though, you have to call the Read method.

neodeaths wrote:
dr10.Close();


Another correct line.


---
b { font-weight: normal; }

GeneralRe: help me see where i did wrong pls Pin
neodeaths16-Aug-06 8:35
neodeaths16-Aug-06 8:35 
AnswerRe: help me see where i did wrong pls Pin
Guffa16-Aug-06 10:14
Guffa16-Aug-06 10:14 
GeneralRe: help me see where i did wrong pls Pin
neodeaths16-Aug-06 15:02
neodeaths16-Aug-06 15:02 
AnswerRe: help me see where i did wrong pls Pin
Guffa16-Aug-06 19:01
Guffa16-Aug-06 19:01 
GeneralRe: help me see where i did wrong pls Pin
neodeaths17-Aug-06 21:14
neodeaths17-Aug-06 21:14 
GeneralRe: help me see where i did wrong pls Pin
Guffa18-Aug-06 7:00
Guffa18-Aug-06 7:00 
GeneralRe: help me see where i did wrong pls Pin
neodeaths18-Aug-06 22:19
neodeaths18-Aug-06 22:19 
QuestionFriendly/Vanity URLs [modified] Pin
Guy Harwood16-Aug-06 6:21
Guy Harwood16-Aug-06 6:21 
AnswerRe: Friendly/Vanity URLs Pin
Jesse Squire16-Aug-06 6:37
Jesse Squire16-Aug-06 6:37 
AnswerRe: Friendly/Vanity URLs Pin
eggsovereasy16-Aug-06 9:46
eggsovereasy16-Aug-06 9:46 
GeneralRe: Friendly/Vanity URLs Pin
Guy Harwood16-Aug-06 11:04
Guy Harwood16-Aug-06 11:04 
GeneralRe: Friendly/Vanity URLs Pin
Jesse Squire17-Aug-06 0:58
Jesse Squire17-Aug-06 0:58 
QuestionASP.net + MYSQL Security Pin
Naveed Kamboh16-Aug-06 6:19
Naveed Kamboh16-Aug-06 6:19 
QuestionDisplaying message(news) in client Browser Pin
meetbinu200316-Aug-06 6:14
meetbinu200316-Aug-06 6:14 
AnswerRe: Displaying message(news) in client Browser Pin
Mike Ellison16-Aug-06 6:18
Mike Ellison16-Aug-06 6:18 
AnswerRe: XmlDataSource Pin
Mike Ellison16-Aug-06 6:16
Mike Ellison16-Aug-06 6:16 
QuestionXPath position() function not working Pin
whozurmommy16-Aug-06 4:53
whozurmommy16-Aug-06 4:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.