Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
Questionxml Pin
md_refay1-Mar-07 0:30
md_refay1-Mar-07 0:30 
AnswerRe: xml Pin
Stefan Troschuetz1-Mar-07 0:48
Stefan Troschuetz1-Mar-07 0:48 
Questiondimension array Pin
md_refay1-Mar-07 0:27
md_refay1-Mar-07 0:27 
AnswerRe: dimension array Pin
Martin#1-Mar-07 0:32
Martin#1-Mar-07 0:32 
QuestionBest way of generating a lookup table Pin
mail5723521-Mar-07 0:13
mail5723521-Mar-07 0:13 
AnswerRe: Best way of generating a lookup table Pin
Stefan Troschuetz1-Mar-07 0:47
Stefan Troschuetz1-Mar-07 0:47 
AnswerRe: Best way of generating a lookup table Pin
thowra1-Mar-07 22:29
thowra1-Mar-07 22:29 
QuestionReturning values Pin
scotlandc1-Mar-07 0:11
scotlandc1-Mar-07 0:11 
Hi,

I hope someone can help.

I have to import some data from a text file into a database. The text files are loaded into a datagrid to be previewed and validated before being imported.

There are some conditions to the import, each child record must have a pre-existing parent record before it will be imported etc. The validation is handled in a stored procedure.

What I need to do is return all of the values that have failed to import in a collection.

public ItemEventCollection failures = null;
...
public ItemEventCollection EventImport(SecurityContext sc, ItemEventCollection EventCollection)
{
if (EventCollection != null)
{

foreach (ItemEvent itemEvent in EventCollection)
{
try
{
ItemEventInsertCommand.Execute(DataAccessManager(sc), itemEvent);
}

catch
{
failures.Add(ItemEvent);
}

}
}

return failures;

}


If I step through the code, failures always has a count of 0 when I know there are rows failing the import conditions. I need to add them to failures then pass it back to a datagrid.

How?

Do I use the out keyword or simply return the ItemEventCollection, I'm really stumped on this one, please can someone help?

Best regards

Scott Wink | ;)


Questionasp.net for google map Pin
Member 387693428-Feb-07 23:37
Member 387693428-Feb-07 23:37 
Questionhow to check if object exists? Pin
arkiboys28-Feb-07 23:30
arkiboys28-Feb-07 23:30 
AnswerRe: how to check if object exists? Pin
Sylvester george28-Feb-07 23:34
Sylvester george28-Feb-07 23:34 
GeneralRe: how to check if object exists? Pin
arkiboys28-Feb-07 23:37
arkiboys28-Feb-07 23:37 
GeneralRe: how to check if object exists? Pin
Sylvester george28-Feb-07 23:39
Sylvester george28-Feb-07 23:39 
GeneralRe: how to check if object exists? Pin
Tuwing.Sabado1-Mar-07 0:17
Tuwing.Sabado1-Mar-07 0:17 
AnswerRe: how to check if object exists? Pin
Martin#28-Feb-07 23:36
Martin#28-Feb-07 23:36 
GeneralRe: how to check if object exists? Pin
arkiboys28-Feb-07 23:38
arkiboys28-Feb-07 23:38 
GeneralRe: how to check if object exists? Pin
Martin#28-Feb-07 23:39
Martin#28-Feb-07 23:39 
AnswerRe: how to check if object exists? Pin
Stefan Troschuetz1-Mar-07 0:24
Stefan Troschuetz1-Mar-07 0:24 
QuestionCreateGraphics Pin
md_refay28-Feb-07 23:15
md_refay28-Feb-07 23:15 
AnswerRe: CreateGraphics Pin
Sylvester george28-Feb-07 23:36
Sylvester george28-Feb-07 23:36 
Questiondelegates Pin
Sunshine Always28-Feb-07 22:48
Sunshine Always28-Feb-07 22:48 
AnswerRe: delegates Pin
Stefan Troschuetz28-Feb-07 23:19
Stefan Troschuetz28-Feb-07 23:19 
Questionadd property to programatically created control Pin
vasu6628-Feb-07 22:37
vasu6628-Feb-07 22:37 
AnswerRe: add property to programatically created control Pin
sam#28-Feb-07 22:41
sam#28-Feb-07 22:41 
GeneralRe: add property to programatically created control Pin
vasu6628-Feb-07 22:53
vasu6628-Feb-07 22:53 

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.