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

C#

 
GeneralRe: escape sequences in C# Pin
Guffa13-Jan-09 0:53
Guffa13-Jan-09 0:53 
GeneralRe: escape sequences in C# Pin
S. Senthil Kumar13-Jan-09 0:56
S. Senthil Kumar13-Jan-09 0:56 
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 
Hi all,

If I have a SqlCommand of which the query includes a join, let's say something as follows:
SELECT * FROM Stock INNER JOIN Transactions ON Stock.StockID = Transactions.StockID

how can I use SqlDataReader[string name] to obtain values from the result coming from a specified field in a specified table? In 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. If I want to compare the two for instance, how can I force SqlDataReader[string name] to return Stock.Price or Transactions.Price?

I was hoping for something like:
using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
{
    while (sqlDataReader.Read())
    {
        if (sqlDataReader["Stock.Price"] != sqlDataReader["Transactions.Price"])
            ShowError("Item was sold at incorrect price");
    }
}


This is a simple example but I hope you get the point. I'm hoping that it isn't necessary to change my SQL query so as to give explicit names to the different columns.
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 
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 

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.