|
There are no rows to update is probably why.
When you fill a DataTable the rows are not "changed", so updating the destination will not find any rows that have changed, so nothing gets added, changed, or deleted.
You would need to set the row "change" indicators with DataRow.SetAdded Method (System.Data) | Microsoft Docs[^] or DataRow.SetModified Method (System.Data) | Microsoft Docs[^] as appropriate before updating the destination.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Uhmm yes,in the destination DataTable there are no rows as it's empty. Basically I would want to transfer the first DataTable contents into the empty one.
|
|
|
|
|
Unfortunately, there is no OleDb equivelant of the SQLBulkCopy class, you will have to set each row as changed to get it to write them.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You're moving data around in "dtBit2", but it has no "connection" to MS Access. In other words, you're not actually writing anything to Access. You're better off doing this "inside" Access and calling the "insert query" if need be, IMO.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi ,
I Have employee task management system .Which has functionality where user can add leave entries taken.
Now i want user to allow to enter leaves for weekdays of given start date and end date excluding weekends if any for given range.
|
|
|
|
|
And?
What have you tried?
Where are you stuck?
What help do you need?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
|
You will also need a list of holiday dates and incorporate them into your exclusion list. These will vary from country to country.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
And if there's any chance the military will use it, be it will be possible to NOT exclude weekends. (Smart troopies just put in for Mon-Fri and hope no one bothers them on the weekends.
|
|
|
|
|
I have designed a system where different groups have different days set up for weekends plus a different set of holidays per group and a staff can be a member of multiple groups and move between them (done in VB6).
Getting the bastards to accept a non midnight clock off was the most difficult job.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
You may proceed with my blessing.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I Have a employee work tracking system written in C# and back end is SQL DB .
In Leave tab user can apply single entry for given date when he wants to take a leave .Now i want to add functionality where user can insert multiple leaves like if he want to go on long Holiday for one/two week ,where he can give start date and end date for his leave plan and code will fill entries against only weekdays for given start and end date and will exclude weekends (Sat and Sun) .
Also need to look Office Holidays in between .
I Hope i have explained my Question enough everyone to understand .
Can anyone please share sample code for same. Dont need any slogans or blessings .
Thanks in Advance ,
Shwetali
|
|
|
|
|
shwetaliv wrote: Dont need any slogans or blessings . We do not provide those, any more than we provide code for people who cannot be bothered to do their own work.
|
|
|
|
|
shwetaliv wrote: Can anyone please share sample code for same.
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for all support .Working on my system further improvements.
|
|
|
|
|
You're welcome.
Good luck with your task.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Message Removed
modified 24-Sep-20 15:26pm.
|
|
|
|
|
Message Removed
modified 24-Sep-20 15:26pm.
|
|
|
|
|
|
|
Hi,
I am fairly new to C#.I am currently writing a windows form program with 50 labels created on the form. I would like to know if there is a better way to change the label's backcolor according to the input number by the user. I am currently using Switch to do it. It makes the coding long and hard to read.
Appreciated if someone can give me advice on this.
My labels are named from label01 ..... label50
Thanks,
John
|
|
|
|
|
You could add all the labels to a List<> object or an array.
That way you can refer to each one by index notation:
Labels[5].BackColor = Color.Green;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
One way is to add the number to the Label.Tag property - every Control has one, and it's a "free object" variable that is for the designer to use as he will.
You can then access each label very easily:
Label lab = Controls.OfType<Label>().FirstOrDefault(c => Convert.ToInt32(c.Tag) == 2);
lab.Text = "Hello";
You could just use the Label.Name property, but that's messier as the VS default names do not have zero padded numbers:
Label1
Label2
...
Label10
Label11
... So you'd need a substring and to rely on the names being in the right order on screen:
Label lab = Controls.OfType<Label>().FirstOrDefault(c => Convert.ToInt32(c.Name.Substring(5)) == 2);
lab.Text = "Hello";
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
modified 22-Sep-20 6:08am.
|
|
|
|
|
You've mentioned: labels, background color, an input number and a switch. If you explain how all this fits together, you'll probably get a better answer.
e.g. Are all labels colored the same based on some choice? Or does every label get their own number? etc.
Most projects fail due to inadequate specs.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|