Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
SuggestionRe: Saving what items are selected from a listbox. Pin
Richard Deeming16-Mar-15 2:37
mveRichard Deeming16-Mar-15 2:37 
QuestionSession ended event not properly working Pin
Member 1085025313-Mar-15 11:58
Member 1085025313-Mar-15 11:58 
AnswerRe: Session ended event not properly working Pin
Eddy Vluggen13-Mar-15 12:06
professionalEddy Vluggen13-Mar-15 12:06 
GeneralRe: Session ended event not properly working Pin
Member 1085025313-Mar-15 12:19
Member 1085025313-Mar-15 12:19 
GeneralRe: Session ended event not properly working Pin
Richard Deeming16-Mar-15 2:32
mveRichard Deeming16-Mar-15 2:32 
GeneralRe: Session ended event not properly working Pin
Member 1085025313-Mar-15 12:51
Member 1085025313-Mar-15 12:51 
GeneralRe: Session ended event not properly working Pin
Eddy Vluggen14-Mar-15 3:47
professionalEddy Vluggen14-Mar-15 3:47 
QuestionError When Table has No Records ... Pin
smh139213-Mar-15 9:27
smh139213-Mar-15 9:27 
Hi All !
I using DataReader for Sum Value of Column :
double Sum = 0.00;
OleDbDataReader dr=null;
string strSum =@"Select SUM(Val1 + Val2 + Val3) as Total from myTable Where year="+Convert.int32(txtyear.Text);
  try
   {
     cnn = new OleDbConnection(strcn);
     cnn.Open();
     OleDbCommand cmd = new OleDbCommand(strSum,cnn);
     dr = cmd.ExecuteReader();
     if (dr.Read())
        {
          int ordinal = dr.GetOrdinal("Total");
          txtFasl_Two_Msvb.Text =    dr.GetDouble(ordinal).ToString();
         }
         else
         {
           txtSum.Text = "0";
         }
     }
     catch(Exception exp)
      {
        MessageBox.Show(exp.ToString());
      }
Sum = Convert.ToDouble(txtSum.Text);
return Sum;

I want to put Zero for Sum if DataReader has no row or Value , but it throw to an exception .
How can handle it ?
Thanks
AnswerRe: Error When Table has No Records ... Pin
phil.o13-Mar-15 11:13
professionalphil.o13-Mar-15 11:13 
QuestionShow Big Number in TextBox Pin
smh139213-Mar-15 1:01
smh139213-Mar-15 1:01 
AnswerRe: Show Big Number in TextBox Pin
Pete O'Hanlon13-Mar-15 1:31
mvePete O'Hanlon13-Mar-15 1:31 
GeneralRe: Show Big Number in TextBox Pin
smh139213-Mar-15 8:27
smh139213-Mar-15 8:27 
AnswerRe: Show Big Number in TextBox Pin
OriginalGriff13-Mar-15 3:13
mveOriginalGriff13-Mar-15 3:13 
GeneralRe: Show Big Number in TextBox Pin
harold aptroot13-Mar-15 5:01
harold aptroot13-Mar-15 5:01 
QuestionProject Architecture Pin
JammoD8712-Mar-15 21:57
JammoD8712-Mar-15 21:57 
AnswerRe: Project Architecture Pin
Eddy Vluggen13-Mar-15 10:54
professionalEddy Vluggen13-Mar-15 10:54 
GeneralRe: Project Architecture Pin
JammoD8715-Mar-15 4:21
JammoD8715-Mar-15 4:21 
AnswerRe: Project Architecture Pin
Subramanyam Shankar17-Mar-15 1:39
professionalSubramanyam Shankar17-Mar-15 1:39 
QuestionHow to use GIT with .Net Pin
AmbiguousName12-Mar-15 3:59
AmbiguousName12-Mar-15 3:59 
AnswerRe: How to use GIT with .Net Pin
Richard Deeming12-Mar-15 4:09
mveRichard Deeming12-Mar-15 4:09 
Questionc sharp user control Pin
Sarita S12-Mar-15 3:32
Sarita S12-Mar-15 3:32 
QuestionRe: c sharp user control Pin
ZurdoDev12-Mar-15 4:38
professionalZurdoDev12-Mar-15 4:38 
AnswerRe: c sharp user control Pin
Richard Givis24-Mar-15 12:05
Richard Givis24-Mar-15 12:05 
AnswerRe: c sharp user control Pin
Dave Kreskowiak12-Mar-15 5:21
mveDave Kreskowiak12-Mar-15 5:21 
SuggestionRe: c sharp user control Pin
Matt T Heffron12-Mar-15 10:20
professionalMatt T Heffron12-Mar-15 10:20 

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.