Based on what you've posted so far, there is no exception possible. But, since we can't see the code that declared these types, the details collection, how it's populated, ..., we really couldn't tell you for sure.
But, if the Select returns no ID's, the array will come back empty and the foreach iterating over it won't do anything.
You don't have to change this code at all.
Next time, you might want to try testing the code with test data specifically designed to try and break it.
string PkgIDs = rData.details.Where(c => c.batch_id == batchID).Select(c => c.Package_ID).Distinct().ToArray();
if(PkgIDs.Count > 0)//This will check the number of elements in the List
foreach (string PkgID in PkgIDs)
In C#, How To Send A Hyperlink Using Query String Method.
I have developing a web application of user enter enters the personal data. That information has sent to admin mail with approve/reject link button.
When the Admin click the approve link, it has approve.aspx page with the user id as query string to update the db as approved. otherwise rejected.
I can try the following code.
mail.Subject = "New User";
mail.Body = "<p>Dear Sir, <br><br> " + txtfname.Text + " " + txtlname.Text + ", has raised a requisition that needs your approval. <br><br><br> Please click to [<ahref='http://localhost:1240/IMA/Approve.aspx?id="+tt+"'> Approve</a> ] [<ahref='Reject.aspx'>Reject</a> ] the request. <br><br><br><b>Note</b> : Please do not reply. This e-mail has been auto-generated.</p>";
mail.IsBodyHtml = true;
In the mail i have move the mouse over the approve link it shows http://.../approve.aspx?id=1, but click the appove link
it shows <a href="http://.../id=1.
For a C# 2010 application, I need to check for the values in a column being all spaces. The number of space characters in a field can change. Thus can you tell me how to tell if a field in a string and/or a datadbase column is all spaces?
I was thinking about a software that can send messages without connecting any phone to your computer. You just have to register your number and than receiver's number and message will be send using your GSM services. If you know what i mean. It will use your phone's credit there is no role of phone physically. I am thinking about using c#. Help if someone can help me.
Help with what, exactly? All you have is a description of what the software should be able to do. No-one will write the software for you; if you want this idea to become reality, you'll have to start writing code. If you get stuck and have a specific question, we could help. "Help" means a pointer in the right direction, not "writing lots of code based on a vague idea". FWIW, I'd recommend researching whether what you want is technically possible.
I do not own a mobile phone, so these might be non-issues to you. Still, I'm wondering how this would work with a prepaid-phone. How will you perform a transaction without physical access to the phone?
Even without prepaid, let's assume a subscription. How would you know who my provider is, and how would you do a financial transaction on that? I bet it's not going to be easy, otherwise a lot of people would simply be stealing credits, wouldn't they?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
Last Visit: 31-Dec-99 19:00 Last Update: 30-Nov-21 8:21