Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
GeneralThreads and random() Pin
gudrunkr13-Jan-09 0:01
gudrunkr13-Jan-09 0:01 
GeneralRe: Threads and random() Pin
SeMartens13-Jan-09 0:06
SeMartens13-Jan-09 0:06 
GeneralRe: Threads and random() Pin
gudrunkr13-Jan-09 0:13
gudrunkr13-Jan-09 0:13 
GeneralRe: Threads and random() Pin
SeMartens13-Jan-09 0:15
SeMartens13-Jan-09 0:15 
GeneralRe: Threads and random() Pin
S. Senthil Kumar13-Jan-09 1:04
S. Senthil Kumar13-Jan-09 1:04 
QuestionQuestion on SqlDataReader[string name] Pin
Dewald12-Jan-09 23:08
Dewald12-Jan-09 23:08 
AnswerRe: Question on SqlDataReader[string name] Pin
SeMartens12-Jan-09 23:14
SeMartens12-Jan-09 23:14 
AnswerRe: Question on SqlDataReader[string name] Pin
Wendelius12-Jan-09 23:35
mentorWendelius12-Jan-09 23:35 
Dewald wrote:
other words, if both the tables Stock and Transactions include a field with the name Price, the result in SqlDataReader will include two columns, both named Price


AFAIK, that wouldn't be possible. Since the Item is an indexer to the column list, there cannot be multiple instances with exactly the same name (which one would the indexer return or how would you refer to the other one, price or price Smile | :) ).

I think the reader works as other classes in the SqlClient so it will add an ordinal number to the end of the column if several columns exists with the same name. So I guess your other column is Price1. The downside is that you cannot be sure which one it is.

Dewald wrote:
sqlDataReader["Stock.Price"]


Single Item is not structural so the dot notation in this case wouldn't have any meaning if structure is considered (although the name of a column can contain a dot).

So after all, the most reliable way is to rewrite the sql. One idea could be that you include your logic (Stock.Price != Transactions.Price) to the sql statement itself using CASE and perhaps event use the condition in where logic (depending what you want). This way your program would have more prepared results and it would be easier to investigate them and perhaps the amount of rows returned would be smaller. But all of this depends on your requirements and logic.

The need to optimize rises from a bad design.My articles[^]

GeneralRe: Question on SqlDataReader[string name] Pin
Dewald12-Jan-09 23:55
Dewald12-Jan-09 23:55 
GeneralRe: Question on SqlDataReader[string name] Pin
Wendelius13-Jan-09 0:02
mentorWendelius13-Jan-09 0:02 
Questionsaving image in image folder using c# Pin
sandhya1412-Jan-09 23:00
sandhya1412-Jan-09 23:00 
AnswerRe: saving image in image folder using c# Pin
musefan12-Jan-09 23:06
musefan12-Jan-09 23:06 
GeneralRe: saving image in image folder using c# Pin
sandhya1414-Jan-09 18:11
sandhya1414-Jan-09 18:11 
GeneralRe: saving image in image folder using c# Pin
musefan14-Jan-09 22:13
musefan14-Jan-09 22:13 
GeneralRe: saving image in image folder using c# Pin
sandhya1415-Jan-09 0:34
sandhya1415-Jan-09 0:34 
GeneralRe: saving image in image folder using c# Pin
musefan15-Jan-09 0:44
musefan15-Jan-09 0:44 
GeneralRe: saving image in image folder using c# Pin
sandhya1415-Jan-09 17:36
sandhya1415-Jan-09 17:36 
QuestionCatching Line-out signal in C# Pin
Maquis.12-Jan-09 22:08
Maquis.12-Jan-09 22:08 
QuestionInstaller components in C# Pin
adi.rusu12-Jan-09 21:59
adi.rusu12-Jan-09 21:59 
AnswerRe: Installer components in C# Pin
rohan_puranik12-Jan-09 23:25
rohan_puranik12-Jan-09 23:25 
GeneralRe: Installer components in C# Pin
adi.rusu13-Jan-09 0:29
adi.rusu13-Jan-09 0:29 
QuestionHow to rotate a form in c#, or maybe just the controlls? Pin
maclinux12-Jan-09 21:09
maclinux12-Jan-09 21:09 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
benjymous12-Jan-09 21:35
benjymous12-Jan-09 21:35 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
musefan12-Jan-09 21:58
musefan12-Jan-09 21:58 
QuestionLog Into Website using WebRequest Pin
AksharRoop12-Jan-09 21:07
AksharRoop12-Jan-09 21:07 

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.