protected void btnSellProduct_Click(object sender, EventArgs e)
{
string sPath = Server.MapPath("~/");
string sFileName = sPath + "item.txt";
string[] sArr;
string[] sArr2;
int lCount;
int lCurrentStock;
int lSellingStock;
if (File.Exists(sFileName.Trim()) == true)
{
sArr = System.IO.File.ReadAllLines(sFileName);
for (lCount =0;lCount <= sArr.Length -1; lCount ++)
{
sArr2 = sArr[lCount].Split(new string[] { "^^^^" }, StringSplitOptions.None);
if (sArr2[0].Trim() == txtSellProdID.Text.Trim())
// Once Control go inside this condition,i want to exit from the for loop. For Dat
// i Write break,but
//for (lCount =0;lCount <= sArr.Length -1; lCount ++)
// in the above line , lCount ++ is underline - Unreachable code detected.
{
lCurrentStock = Convert.ToInt32(sArr2[3]);
lSellingStock = Convert.ToInt32(txtQtyToSold.Text);
if (lSellingStock > lCurrentStock)
lblStatus.Text = "Could not Sell this Product.Out of Stock";
else
{
WriteToTransactionFile();
DecrementFromItemFile();
lblStatus.Text = "Transaction Processed Successfully";
}
}
break;
}
}
}
Last edited by peter_budo; Jul 18th, 2009 at 12:50 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
hi ramesh thx very much,its working,hi adatapost, when i didnt put the code,i got the answers put the code,when i start putting it,i got not to put it...
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Previous Thread in ASP.NET Forum Timeline:Need Help