|
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
|
|
|
|
|
i am gettting the error message saying that "the google api map key used for this site is registered for different site. also please guide me for coding part,i dnt know what changes should i do in order to be able to view google map written in asp.net.
|
|
|
|
|
How is it possible if an object exists?
At present I have a code similar to this line:
//This retrieves the object...
objectData = MethodName(Name)
If the object does not exist, it goes to the catch statement.
How can I just check if it exists so that it does not go to the catch statement?
Something like:
if (MethodName(Name) not null)
{
}
else if (MethodName(Name) == null)
{
}
Thanks
|
|
|
|
|
if(objectData != null)
{
//do your codings here
}
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
I would like to check something like:
if (methodname(name) != null)
Is this possible?
|
|
|
|
|
yes it is possible
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Yes, but only if the returning value of MethodName is a nullable object. If not your codition is always true.
Post the snippet of MethodName...
Regards,
Mark
|
|
|
|
|
What is "MethodName" doing?
|
|
|
|
|
|
arkiboys wrote: creates an object
How?
|
|
|
|
|
objectData = MethodName(Name);
if (objectData == null)
{
}
else
{
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i want to convert button style to appear as circle
or
drawing circle on the form and event these circles
ma_refay
|
|
|
|
|
have to create customised buttons with two images one is for up and another one is for down.
when the user clicks the image need to show the down image.
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hi
can anyone give me a sample application to create delegate in C#?
|
|
|
|
|
MSDN delegates tutorial[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I have created Button control programatically using
Button btn = new Button();
btn.ID = "btn1";
btn.Text = "Button 1";
Panel1.Controls.Add(btn);
i want to set the enable property for this button to be false.
how do i do it
vasu
|
|
|
|
|
|
sorry i have not given the full scenario.
what i want to do is fetch the property and its value from database.
how do i say [ctrl].[property] = [value]
|
|
|
|
|
sorry i have not given the full scenario.
what i want to do is fetch the property and its value from database.
how do i say [ctrl].[property] = [value]
vasu
|
|
|
|
|
Hello,
I think what you are looking for is reflection!
Have a look at the GetType and GetProperty methods.
All the best,
Martin
|
|
|
|
|
Martin thanks for the lead. will try it out and post the progress
|
|
|
|
|
i think either you are a little confused or i am not getting properly.
you can put check on fetched data it would be kind fo Hard Coding
but i dont think you have any other way to do it
if you have any idea then please let me know . for bettr help please paste a piece of your code
|
|
|
|
|
is there a dll file for audio recording from microphone
|
|
|
|
|
Hello gurus,
I'd like to know how can see if my application already runs or not?
Only 1 instance of my application can run.
How to do that?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
Hi
You could use this method:
Use the following code on you load or main method
if (PrevInstance())<br />
{<br />
MessageBox.Show("The program is already running");<br />
Application.Exit();<br />
}
This is the method called from your main code
private static bool PrevInstance()<br />
{<br />
if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)<br />
{<br />
return true;<br />
}<br />
return false;<br />
}
Hope this helps.
|
|
|
|