Click here to Skip to main content
15,887,998 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# session Pin
Anubhava Dimri8-Apr-11 20:50
Anubhava Dimri8-Apr-11 20:50 
AnswerRe: C# session Pin
dan!sh 9-Apr-11 5:34
professional dan!sh 9-Apr-11 5:34 
AnswerRe: C# session Pin
Ganesh Kumar Kaki13-Apr-11 1:21
Ganesh Kumar Kaki13-Apr-11 1:21 
QuestionWebserver only sending text occasionally? [modified] Pin
venomation8-Apr-11 16:38
venomation8-Apr-11 16:38 
AnswerRe: Webserver only sending text occasionally? Pin
Richard Andrew x649-Apr-11 3:27
professionalRichard Andrew x649-Apr-11 3:27 
GeneralRe: Webserver only sending text occasionally? Pin
venomation9-Apr-11 4:59
venomation9-Apr-11 4:59 
AnswerRe: Webserver only sending text occasionally? Pin
BobJanova11-Apr-11 5:10
BobJanova11-Apr-11 5:10 
QuestionHow to get a value to return in a textbox Pin
Justiin12658-Apr-11 12:15
Justiin12658-Apr-11 12:15 
Hi,

I am having issues for a project for work and was wondering if anybody can help me. I am trying to calculate The percentage for refurb for the day. The formula is Refurb_Rate = (totalRefurb / totalUnits * 100) The program is supposed to supposed count the refurb in the db and return a value in a textbox. I initialized my values to 0, but my problem is how do I get it to calculate each time a user scans in a unit to be refurbed. Anything I try to do gives me an error in my program. Right now it's returning a value of of 1 because I added RefurbRate++. Can anyone help me? Thanks.

Justin

Here is what I've done with my code:

private int GetRefurbRate()
{
string sql = "";
int Refurb_Rate = 0;
int totalRefurb = 0;
int totalUnits = 0;
string error_msg = "";

sql = "SELECT COUNT(*) " +
"FROM " + schema + ".repair_part rp " +
"WHERE rp.repair_ord = '" + txtRO.Text + "' ";
while (true)
{
if (!myDb.RunSql(sql, true))
{
error_msg = "DBError for getting Refurb Rate";
break;
}
if (myDb.dbRdr.HasRows)
{
if (myDb.dbRdr.Read())
{
try
{
Refurb_Rate = (totalRefurb / totalUnits * 100);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}

Refurb_Rate++;
}
break;
}
myDb.dbRdr.Close();
if (error_msg != String.Empty)
{
MessageBox.Show(error_msg, "Get Refurb Rate",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
return Refurb_Rate;
AnswerRe: How to get a value to return in a textbox Pin
Colin Angus Mackay8-Apr-11 14:15
Colin Angus Mackay8-Apr-11 14:15 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:28
Justiin12658-Apr-11 16:28 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 15:01
sitebuilderLuc Pattyn8-Apr-11 15:01 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:39
Justiin12658-Apr-11 16:39 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 17:10
sitebuilderLuc Pattyn8-Apr-11 17:10 
AnswerRe: How to get a value to return in a textbox Pin
davidnz8-Apr-11 15:32
davidnz8-Apr-11 15:32 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:44
Justiin12658-Apr-11 16:44 
GeneralRe: How to get a value to return in a textbox Pin
Rotted Frog8-Apr-11 22:29
Rotted Frog8-Apr-11 22:29 
Questionthread.interrupt only working once Pin
Member 74021668-Apr-11 10:40
Member 74021668-Apr-11 10:40 
AnswerRe: thread.interrupt only working once Pin
davidnz8-Apr-11 12:13
davidnz8-Apr-11 12:13 
AnswerRe: thread.interrupt only working once Pin
Ganesh Kumar Kaki13-Apr-11 1:27
Ganesh Kumar Kaki13-Apr-11 1:27 
QuestionGlobal Hook : need help with SysMsgProc Pin
moums8-Apr-11 8:12
moums8-Apr-11 8:12 
QuestionQuerying LDAP from an application: get a search result when one attribute of a multiple attribute matches Pin
Bernhard Hiller8-Apr-11 1:28
Bernhard Hiller8-Apr-11 1:28 
AnswerRe: Querying LDAP from an application: get a search result when one attribute of a multiple attribute matches Pin
Ravi Bhavnani8-Apr-11 9:10
professionalRavi Bhavnani8-Apr-11 9:10 
QuestionWindow 7 and WebClient Class Pin
Wolfram Steinke7-Apr-11 17:32
Wolfram Steinke7-Apr-11 17:32 
AnswerRe: Window 7 and WebClient Class Pin
Bernhard Hiller7-Apr-11 21:58
Bernhard Hiller7-Apr-11 21:58 
GeneralRe: Window 7 and WebClient Class Pin
Wolfram Steinke9-Apr-11 0:20
Wolfram Steinke9-Apr-11 0: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.