Now i have taken my csv file and imported to a DataTable, i've parsed out the rows and columns to match two colums in SQL. If the two fields match, i want to create a record on a SQL Table. The problem is, I have 4 fields in the CSV file that I would like to "Concatenate" (don't know the syntax for c#) the first 4 columns in the CSV file to one column on the SQL Table. I'd be happy if you can just guide me in the right direction, is there a concatenate or append syntax i should be looking at? I'm doing this for the invoiceNumber column.
code snippet:
Expand|Select|Wrap|Line Numbers
- foreach (string csvRow in extractCsv)
- {
- try
- {
- DataTable table = ConvertCSVtoDataTable();
- foreach (DataRow csvrow in table.Rows)
- {
- foreach (DataColumn col in table.Columns)
- {
- string colloCode = csvrow[15].ToString();
- string fiscalYear = csvrow[13].ToString();
- string invDate = csvrow[4].ToString();
- foreach (DataRow row in colloCodeTable.Rows)
- {
- if (colloCode == row["collocationCode"].ToString() && fiscalYear == row["fiscalYear"].ToString())
- {
- //string expDesc = "";
- //if (expDesc == "")
- //{
- // //mapExpenseDescription();
- //}
- Expense newExpense = new Expense();
- newExpense.CollocationCodeID = new System.Data.SqlTypes.SqlGuid(row["collocationCodeID"].ToString());
- string accountCode = csvrow[18].ToString();
- //expenseDescription = csvFields[18].ToString();
- string invoiceDate = Convert.ToString(csvrow[4].ToString());
- string invoiceNumber =
- // // string ledgerCode = "0"
- // // string processDate = filestring.
- // // string transactionAmount = filestring.
- // // string vendorName = filestring.
- // // string
- // //newExpense.AccountCode = Convert.ToInt16(accountCode);
- // newExpense.Persist();
- }
- }
- }
- }
- }
- catch { }
- }