I would like to compare a CSV field "Name" with a SQL Server table field "ResourceName" and write out the person that is not in the SQL server table.
if (this.DataCenterLaborFileUpload.HasFile)
var extension = Path.GetExtension(DataCenterLaborFileUpload.FileName);
string currentName = "";
decimal currentHours = 0.00M;
decimal currentFTE = 0.00M;
string ResourceName = "";
if (extension == ".csv")
StreamReader csvreader = new StreamReader(DataCenterLaborFileUpload.FileContent);
DataTable dt = new DataTable();
dt.Columns.Add("txtName");
dt.Columns.Add("txtHours");
dt.Columns.Add("txtFTE");
while (!csvreader.EndOfStream)
DataRow dr = dt.NewRow();
var line = csvreader.ReadLine();
var values = line.Split(',');
if (values[0].Trim() != "Pers.No.")
using (DbConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLStaffingConn"].ConnectionString))
conn.Open();
using (DbCommand cmd = conn.CreateCommand())
cmd.Connection = conn;
cmd.CommandText = "SELECT ResourceName FROM
StaffTracking order by PersonnelResourceType, ResourceName";
// DbParameter p1 = cmd.CreateParameter();
// p1.ParameterName = "restype";
// p1.Value = "Supplier";
// cmd.Parameters.Add(p1);
using (DbDataReader row = cmd.ExecuteReader())
while (row.Read())
ResourceName = row.GetString(0);
if (ResourceName != (values[1].Trim()))
if (values[1].Trim() == currentName)
currentHours = currentHours + Convert.ToDecimal(values[9].Trim());
else
if (currentName == "")
dr["txtName"] = currentName;
dr["txtHours"] = currentHours;
dr["txtFTE"] = currentFTE + Math.Round(currentHours / (weekdaysInMonth() * 8), 2);
dt.Rows.Add(dr);
dt.AcceptChanges();
currentHours = Convert.ToDecimal(values[9].Trim());
currentName = values[1].Trim();
DataRow drfinal2 = dt.NewRow();
drfinal2["txtName"] = currentName;
drfinal2["txtHours"] = currentHours;
drfinal2["txtFTE"] = currentFTE + Math.Round(currentHours / (weekdaysInMonth() * 8), 2);
dt.Rows.Add(drfinal2);
dt.AcceptChanges();
gvDataCenterLabor.DataSource = dt;
gvDataCenterLabor.DataBind();
// Page.DataBind();
Here is my csv file:
Pers.No.
Name
HomeFID
Copy Range/Value from Column V
Worked Date
Job Code
Account
Pay Type
Activity Type
Hours
11111111
Doe Jane
USA7064810
US1-08333.01.08.02.03
20150223
00S15H
9.61E+09
410
8
11111111
Doe John
USA7064810
US1-08333.01.08.02.03
20150210
00S15H
9.61E+09
410
9
11111111
Smith Jane
USA7064810
US1-08333.01.08.02.03
20150226
00S15H
9.61E+09
410
8
So if Doe Jane is not in the SQL table I would like to only display her.
It's only displaying the ones from the CSV file that are in the SQL Table.
Thanks
Hi
Please use this insert
code button to provide code next time. It could better to help us to review your code.
Now let's focus your question, I have tried to test with your code. But failed.
I would suggest that you could export columns "Name" and "ResourceName" to DataTable.
Then use DataTable to compare and filter with its column value.
Here is a helpful reference:
Comparingtwo DataTables by specific
column in C# [closed]
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
Is there a way to sort a PDF file with multiple pages by a specific field within the PDF? All pages have the same invoice format and i would like to sort by a field within and then print the documents. (Vendor, PO#, Date, ect.)
When you say field, do you mean specifically a form field, such as a text field? Or is the information regular text on the page?
-
That's my question - Can I upload a visual presentation with my audio and if I can do that, how?
TIATo do this you need to make your audio file an .m4a one, which will allow you to add chapter markers and images to the chapters. If you have a Mac the easiest way to do this is to use the podcast creation facility in GarageBand. There are a few other programs: search on 'enhanced podcast' to find some in Google.
When the podcast is created and accepted into the iTunes Store people will need to subscribe to see your images: in iTunes v11 they have to command-click (Mac) or control-click (Windows) on the small image at the top of the window while playing an episode: as this isn't immediately obvious you might want to make an announcement at the beginning telling them to do this.
My 'get you started' page on podcasting may be of some help:
http://rfwilmut.net/pc -
Using iPhoto 09, 8.1.2 How do I re-route saving pictures to the hard drive? Currently am saving to files on 'my' partition, and would like to change to save to a shared file so both partitions can view and access.
Drag the Library from the Pictures folder to the Users/Shared folder. I would point out that folks doing this on 10.6 and later frequently meet permissions issues. You might do better moving it to an appropriately formatted External Disk.
-
Acmcneill1ug 14, 2014 7:16 AM
I have IMac OSX 10.9.4, 4GB,Processor 3.06 with Intell2Duo. I would like to check for Malware. I run a TechTool Pro 6 every month and that comes up great.
When check how much memory I am using, with only Safari open I am using 3.9 and more of her 4.0 memory. She is very. very slow in processing. I had 4000
trash to clean out and it took her over an hour to expel. Also for some reason Safari will not allow me to click on a link, in my G-mail, and let it go to the page.
It has a sign saying a pop-up blocker is on and will not let me do it. I must open the stamp to look at my e-mails and if I have redirected link now I can do it.
I have not changed my preferences so where is this pop-up blocker?
I have looked at preferences on Safari and Google, which I do not understand Google, and do not see where this blocker could be.
Malware is something I want to make sure is not on my computer. Tech Tool Pro 6 is all I know of and it does not detect Malware.
Help.
CeilTry Thomas Reed's Adware removal tool. He posts extensively in the communities.
Malware Guide - Adware
Malware Discussion -
I would like to know how can I set songs in iTunes to play at different times automatically during the day. i.e. one song at 10am the other at 10:30am etc..
-
I would like to pay for apple tv rentals with a different credit card from my iTunes Store. How can I do this?
Any purchases made from the iTunes Store, on your computer, AppleTV, or iOS device, use the same billing information that is associated with your account. To pay with a different credit card, log in to your account and change the payment options associated with your account. If you want to use different payment options on different devices, you may want to consider utilizing multiple iTunes accounts, each with its own payment options.
To learn more about changing your iTunes account information, see this article: http://support.apple.com/kb/ht1918 -
I would like to use DDE to send data from a Lookout Server to an Excel
Hello National Instruments,
I would like to use DDE to send data from a Lookout Server to an Excel
Spreadsheet.
I have Lookout 6.1 on a server connected to 4 client workstations
The operating system on the server is Windows Server 2003 R2; Standard Edition;
Service Pack 2
I have opened DDE Share but after filing in Share Name; Static Application
Name; Static Topic Name
I get a message, "Can't bind to DSDM service"
I also get this message when I press add a Share
What are the steps to setting up this type of communications link?
Thanks,
David Lopez
Scada Functional AnalystRyan,
I have followed the steps on the Knowledge Base "How do I use DDE To Send Data Across the Network To Excel From Lookout?" but what I am seeing is that the computer with excel (Computer B)hangs up displaying an hour glass continuously leaving me no option but to go into task manager to stop excel. It appears to me that the dde share is not working properly on my windows xp where lookout resides or I do not have a certain service turned on. I do have the DDE services turned on both computers. I have my computer set up as computer A with Lookout and Process1 as the process with a pot set up as pot1. On my computer (Computer A) I also have the dde share set up per the KB example.
On computer B I have the dde services turned on and I am typing the following into an excel worksheet Cell ='\\TAG23232\NDDE$'|'Process1$'!Pot1
TAG 23232 is Computer A's Name
Do you have any suggestions??? -
Hello, i use premiere pro cc and i would like to upload my sequence in speedgrade with direct link but it's not available. I can see the option but it's not clickable, somebody knows why ?
Oh i'm not sure they are on same, i downloaded speedgrade this morning and i didn't upgraded premiere so it's maybe this ! thanks i will try it and let you know
-
I have the iPhone 4S and would like to purchase a docking device. I have the Otter Box Camo case and would like to know which dock will work with the
case ON. Thank you.it might be better to contact otterbox to find out from them what they made it compatible with.
-
Hello! I would like to know about unlock my iphone 4? IMEI **** Serial number 87******A4T And what operator it is locked?
<Edited By Host>I don't know if they have email but you can start here http://www.apple.com/support/contact/
-
I would like to be reached at my iMessage with my mobile number and not my email address
I would like to be reached at my iMessage with my mobile number and not my email address
If you're finding that iMessage & Facetime is showing your email as default & your number is greyed out so can't select it then try signing out of iMessage & Facetime & signing in again.
-
How do you create a mixed media disc? I would like to include a slideshow/movie as well as include a .pdf of a photo book on the same disc. I would like the movie to play on any DVD player.
Do you want the pdf available to view or just for copying from the disk to a computer for viewing.
To view a PDF you can do a Print ➙ PDF ➙ Save PDF to iPhoto which will create a jpg of each page of the pdf and save it to iPhoto. From there you can send the PDF jpegs to iDVD to make a slideshow of the pages. It's the same principle as used in this tutorial: 06 - Creating an iDVD Slideshow From an iPhoto Book.
If you don't have the Safe to iPhoto workflow in your HD/Library/PDF Services folder you can download it from Toad's Cellar.
Happy Holidays -
I have Logic Pro 8.0.2 and would like to upgrade. I'm running OS Lion on a 2010 MacB Pro. What is the best option? Logic Pro 9 App or Logic Studio? Can't find upgrade price. Or should I just stay with Logic 8?
Same here, I have Logic Studio 8 and wouldn't mind staying with that version, except that the installer won't run on my new Macbook Pro as PowerPC apps are no longer supported. That's the message I get in any case.
I use to run Logic on a 2006 Macbook Pro.
I guess that makes me a very unhappy Apple user! I've been using Logic from the Emagic days, bought every upgrade only to see Apple kill what used to be one of the best Pro Audio application. Imagine if they had done the same to Photoshop, there would be a lot of unhappy designers out there
Paying the full price for years to slowly see your daily app go down in price & efficiency until it's given away at $199 for semi pro users. Well, at least ProTools is stil alive & kicking so I guess that's the way forward now.
This is coming from someone that never ever used a Windows machine to make music! Life is good still! -
Hi, I would like to know if there is anything i can do to stop my emails from moving from the senders name, once i have forwarded it to some one else?
No there is nothing you can do to correct it. It is a hardware fault and only Apple can correct it by replacing parts in your Mac. More then likely the Logic board has failed. Specifically the GPU which is soldered to the Logic board so the complete logic board must be replaced.
Maybe you are looking for
-
What is the minimum spec for a Macbook Pro to run FCPX?
I have FCP X installed on my 2009 iMac which has 8Gb of RAM. It works okay, more or less, but I need the portability of a laptop. As cash matters, what is the cheapest Macbook Pro option? I would boost the RAM to 8gb but what else woud I need? I wou
-
Outgoing messages not working with POP e-mail account
I am getting a strange message each time I try to send outgoing e-mail messages with my iPhone 3G. It says that my recipients e-mail address in invalid. I have tried multiple e-mail addresses and it always says the same thing when I try to send. My o
-
I recently tried to obtain an Aperture serial number and through the process found out that I am not receiving emails from Apple. With an Apple tech support's help, was able to get her basic email but one with any links in the body of the message, wo
-
Need solid pro dj software for live mixing-any suggestions?
Tried Traktor, PCDJ and Virtual DJ with my Dell-with good results-recently converted to the MacBook Pro and love it. PC gone bye bye! Need solid pro dj software for club mixing. Thanks, ps I saw Michael Dell recently at a Texas Rangers game....with a
-
DPS Viewer for Android mobiles
Since we launched our publication on the IPAD and the IPhone, we have been receiving alot of requests from customers to launch the publication on android devices. After doing some survey, most of the requests are coming from people with Samsung S2, S