I have small exec(old one) that treat adding members to a table in the DB. if the member not exist in the DB, it will insert new member in AllMember table. If the member already exists in the DB, it will update the values that are different. What exists already in the code is not updating all the members as I want. I want to code it efficiently now. For every update, I am taking all of the members from the DB(6000) and if I have excel with 4000 members it will make the comparison 24000000 and will increase with time.
Getting all the members:
public static IEnumerable<AllMember> GetAllMembersList()
{
string connection = ConfigurationManager.ConnectionStrings["connectionString"].ToString();
using (var dataAccess = new DataAccessDataContext(connection))
{
var v = (from row in dataAccess.AllMembers
//where row.PremiumType.HasValue && row.PremiumType.Value == 100
select row);
return v.ToList();
}
//#TODO fun
}
Handle the file of new\update members
internal override void ProcessFile()
{
StringBuilder CheckMembersList = new StringBuilder();
CheckMembersList.Clear();
ErrorFounds = false;
UpdateQuery = new StringBuilder();
if (!System.IO.File.Exists(InputFile))
{
Mail.InsertNewMail("שגיאה בתהליך קליטת פרטי משתמשים ", "הקובץ " + InputFile + " לא נמצא ");
return;
}
CsvReader fileReader = new CsvReader(InputFile, FileEncoding, false, false);
DataTable fileContentTable = fileReader.ReadFile();
FileInfo fileInfo = new FileInfo(InputFile);
UpdateDB(fileContentTable, CheckMembersList);
WriteResponseFile(fileContentTable);
}
Updating the DB:
private void UpdateDB(DataTable inputTable, StringBuilder CheckMembersList)
{
IEnumerable<AllMember> allMembersList = Utilities.GetAllMembersList();
DBUpdateStatus updateStatus = DBUpdateStatus.NO_CHANGE;
bool x;
bool newMember;
int rowIndex=0 ;
for (int i = 1; i < inputTable.Rows.Count; i++)
{
rowIndex = i;
DataRow fileRow = inputTable.Rows[i];
newMember = true;
foreach (AllMember membersRow in allMembersList)
{
if (!(String.IsNullOrEmpty(membersRow.TZ))) /*&& (fileRow[ConstDBRow.TZ].ToString().Trim().PadLeft(9, '0') == membersRow.TZ.ToString().Trim().PadLeft(9, '0')))*/
{
newMember = false;
updateStatus = UpdateMemberDetails(fileRow, membersRow);
break;
}
}
if (newMember == true)
updateStatus = InsertNewMember(fileRow);
var memberId = GetMemberId(fileRow[ConstDBRow.TZ].ToString().Trim().PadLeft(9, '0'));
if (updateStatus != DBUpdateStatus.NO_CHANGE)
QueryBuilder.InsertRequest(memberId, updateStatus);
fileRow["UPDATE_STATUS"] = Utilities.GetStatusString(updateStatus);
//append to CheckMembersList for sending members list through email
CheckMembersList.AppendLine("Row Index: " + Convert.ToString(rowIndex + 1) +", Identification number: " + (fileRow[ConstDBRow.TZ].ToString().Trim().PadLeft(9, '0')) + ", First Name: " + fileRow[ConstDBRow.FIRST_NAME].ToString().Replace("'","''") + ", Last Name: " + fileRow[ConstDBRow.LAST_NAME].ToString().Replace("'","''") + ", Update Status: " + fileRow["UPDATE_STATUS"].ToString().Replace("'", "''") + "<br/>");
}
}
How can I do this effectively? Is EntityFramework a good option or taking the list of All-Members differently?
I would leave it on DB to compare the records and insert/update using Merge SQL statement.
There is Merge in SQL Server, hope it is available on other DB servers too https://learn.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-2017
As a note: Are you doing insert/update request for each of your record? Try to perform one DB call
Related
I am reading word file and add data after it find Favour. Just wont to add data after favour. First record using this code added perfect record but second time it give Syntax error(operator missing). Please help me to correctly add all records
private void button1_Click(object sender, EventArgs e)
{
try
{
Microsoft.Office.Interop.Word.Application app = new Microsoft.Office.Interop.Word.Application();
object nullobj = System.Reflection.Missing.Value;
object file = openFileDialog1.FileName;
Document doc = app.Documents.Open(#"C:\Users\juilee Raut\Downloads\ITCL-CAES 1 (1).docx");
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject da = Clipboard.GetDataObject();
string text = da.GetData(DataFormats.Text).ToString();
richTextBox1.Text = text;
string data = string.Empty;
string[] data1 = richTextBox1.Lines;
List<string> Info = new List<string>();
int i = 0;
int j = 0;
int m = 0;
while (i < data1.Length)
{
if (data1[i].StartsWith("FAVOUR:"))
{
j++;
if (m == 0)
{
data = data + data1[i].ToString() + Environment.NewLine;
string inf = string.Join(Environment.NewLine, Info.ToArray());
con.Open();
OleDbCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT into AllData(FullJud) VALUES('" + inf + "')";
cmd.ExecuteNonQuery();
con.Close();
Info.Clear();
inf = string.Empty;
m = 1;
}
}
else
{
m = 0;
if (data1[i] != "")
{
if (data1[i].EndsWith("2017") && data1[i].Length == 10 || data1[i].EndsWith("2016") && data1[i].Length == 10)
{
data = data + data1[i].ToString() + Environment.NewLine + "##ln##" + Environment.NewLine;
Info.Add(data1[i]);
Info.Add("##ln##");
}
else if(data1[i].StartsWith("SECTION:") || data1[i].StartsWith("Section:") || data1[i].StartsWith("SECTION-") || data1[i].Contains("SUBJECT:") || data1[i].StartsWith("Subject:") || data1[i].StartsWith("SUBJECT-") || data1[i].StartsWith("SUBJECTS:"))
{
data = data + data1[i].ToString() + Environment.NewLine;
}
else if(data1[i].EndsWith("Respondent.") || data1[i].EndsWith("Petitioner.") || data1[i].EndsWith("Appellant.") || data1[i].EndsWith("Appellant") || data1[i].EndsWith("Respondent") || data1[i].EndsWith("Counsel,"))
{
data = data + data1[i].ToString() + Environment.NewLine;
}
else
{
data = data + data1[i].ToString() + Environment.NewLine;
Info.Add(data1[i]);
}
}
}
i++;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
This is the error I get:
"Syntax error (missing operator) in query expression ''391 ITR 382 (BOM): 88 TAXMANN.COM 556\r\nHIGH COURT OF BOMBAY \r\nM.S. SANKLECHA AND A.K. MENON, JJ.\r\nMalay N. Sanghvi v/s. Income Tax Officer\r\nIT APPEAL NO. 1342 OF 2014\r\n31.01.2017\r\n##ln##\r\nSection 80-IB of the Income-tax Act, 1961 - Deductions - Profits a'."
What if Info contains several values, let's say:
Info = { "value1", "value2" }
Then, inf would be:
inf = "value1\r\nvalue2"
Therefore, cmd.CommandText would be:
cmd.CommandText = "INSERT into AllData(FullJud) VALUES('value1\r\nvalue2')";
and I'm quite sure this is not the wanted behaviour.
Edit
What if one value in Info contained a ' character?
Info = { "val'ue" }
Then, inf would be:
inf = "val'ue"
Therefore, cmd.CommandText would be:
cmd.CommandText = "INSERT into AllData(FullJud) VALUES('val'ue')";
// SQL won't understand that part --------------------------|||
and that's where you get an error.
Moreover, what if Info had the following value instead:
Info = { "value1');DROP TABLE [anytable];--" }
That's typical SQL Injection.
Some questions/comments:
What is j used for?
What is the purpose of inf = string.Empty;? It is a local variable and will be garbage collected.
What is the purpose of data? Will you even use it at some point?
You are using a while loop when you could be using a for(int i=0;i<data1.Length;i++) loop.
What if data1 contains two consecutive strings starting with "FAVOUR:"? Why would you insert only the first one, and not the second one?
else
{
data.Replace("'", "/");
data1[i] = data1[i].Replace("'","/");
Info.Add(data1[i]);
data = data + data1[i].ToString() + Environment.NewLine;
}
In else part I just replace the ' to / and my problem is solve
I'm trying to write a program which will made a datagridview based on a text file. See code below.
private void Button1_Click(object sender, EventArgs e)
{
ls_datenTabelle.Clear();
ls_datenTabelle.Columns.Clear();
string kdstr = (comboBox1.SelectedItem.ToString());
string fileName = "ls.txt";
string fileName2 = kdstr + ".txt";
string sourcePath = #"H:\import_directoy\customer\" + kdstr;
string tempPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
string dmitempPath = #"program_name\";
string targetPath = Path.Combine(tempPath, dmitempPath);
File.Delete(targetPath + "output");
string sourceFileName = Path.Combine(sourcePath, fileName);
string destFile = Path.Combine(targetPath, fileName2);
Directory.CreateDirectory(targetPath);
File.Copy(sourceFileName, destFile, overwrite: true);
using (var output = File.Create(targetPath + "output"))
{
foreach (var file in new[] { "H:\\directoy1\\directoy2\\index.config", destFile })
{
using (var input = File.OpenRead(file))
{
input.CopyTo(output);
}
}
}
string[] raw_text = File.ReadAllLines(targetPath + "output", Encoding.Default);
string[] data_col = null;
int x = 0;
foreach (string text_line in raw_text)
{
data_col = text_line.Split(';');
if (x == 0)
{
for (int i = 0; i <= data_col.Count() - 1; i++)
{
ls_datenTabelle.Columns.Add(data_col[i]);
}
x++;
}
else
{
ls_datenTabelle.Rows.Add(data_col);
}
}
ls_dataGridView.DataSource = ls_datenTabelle;
this.Controls.Add(ls_dataGridView);
ls_dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
ls_dataGridView.AllowUserToAddRows = false;
}
Now I want to search all over this datatable/datagridview and I will show the rows if the search function found the searchvalue in any column.
But I dodn't know how. The header of the table could change every day. So this code doesn't work for me:
public void findingValue(object sender, EventArgs e)
{
string searchValue = textBox1.Text;
DataView data = ls_datenTabelle.DefaultView;
ls_dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
data.RowFilter = string.Format("Name like '" + searchValue + "%'");
}
The program will find only rows where the searchValue is in the "Name" column and not one of the other 18 (umknown) columns.
Here is an example which uses Linq to loop over the columns in the DataTable:
if (searchValue == "") data.RowFilter = "";
else
{
var cols = ls_datenTabelle.Columns.Cast<DataColumn>().Select(x => x.ColumnName);
var filter = cols.Select(x => x + " like '" + searchValue + "%'")
.Aggregate((a, b) => a + " OR " + b);
data.RowFilter = filter;
}
First we collect the column names and then we build a filter from them, each part connectd with a OR clause.
You could also use Join or good old loops..
Note that this assumes that all columns allow searching for strings, i.e. no numbers etc..
If this is not true you will want to either pick only the string columns or change the filter for non-string columns, if searching them makes any sense.
To restrict the search to string columns simply insert
.Where(x => x.DataType == typeof(string))
between Cast and Select, so that cols contains only searchable columns..
If instead you want to search numeric columns you could write the filter like this:
var filter = cols.Select(x => "Convert(" + x + ", 'System.String') like '"
+ searchValue + "%'").Aggregate((a, b) => a + " OR " + b);
This uses the Convert function of the expression syntax . But why would one search for numbers starting with some digits..?
Here is a test with 2 string, 1 numeric and one datetime columns. The filter works for all; note that for the test I have added an extra '%' to extend the search to the whole values, not just the start..
I want to use textbox and checkboxlist to search data in gridview using asp.net c#. Using textbox can search the data. But for checkboxlist only can search the data when check only one checkbox. If check more than one checkbox, can't search the data. thanks a lot for helping.
the code:
c# code
protected void btnSearch_Click(object sender, EventArgs e)
{
if (cblDay.SelectedIndex != -1)
{
foreach (ListItem val in cblDay.Items)
{
if (val.Selected == true)
{
RptRateData.Day += val.Value + "";
}
}
}
RptRateData.RateAmount = txtRate.Text.Trim();
BindGrid();
}
code for class:
public string RateAmount { get; set; }
public string Day { get; set; }
internal DataSet GetRptRateSet()
{
DataSet tmpDS = new DataSet();
try
{
string strSQL = #"SELECT ComplexRateInfo.ComplexRateId,
ComplexRateDetailInfo.Day,
ComplexRateInfo.RateAmount
FROM ComplexRateInfo
LEFT JOIN ComplexRateDetailInfo ON ComplexRateInfo.ComplexRateId = ComplexRateDetailInfo.ComplexRateId ";
string whereSQL = " WHERE";
string orderBySQL = " order by Day ;";
int filterCount = 0; //to keep track of needed filter that are going to be used by the sql string
string[] sIndex = new string[2]; //to keep track of scalar variable needed by the sql, four string of sIndex because maximum filter available is 4
int indexCount = 0; //count to access sIndex members
//filter with or without day
if (_ds.Day != null && _ds.Day != "")
{
if (filterCount > 0) //query need additional filter
whereSQL = whereSQL + " AND ComplexRateDetailInfo.Day LIKE '{" + filterCount + "}'";
else //if this is the first filter
whereSQL = whereSQL + " ComplexRateDetailInfo.Day LIKE '{" + filterCount + "}'";
filterCount++;
sIndex[indexCount] = _ds.Day;
indexCount++;
}
//filter with or without rate amount
if (_ds.RateAmount != null && _ds.RateAmount != "")
{
if (filterCount > 0) //query need additional filter
whereSQL = whereSQL + " AND ComplexRateInfo.RateAmount LIKE '{" + filterCount + "}'";
else //if this is the first filter
whereSQL = whereSQL + " ComplexRateInfo.RateAmount LIKE '{" + filterCount + "}'";
filterCount++;
sIndex[indexCount] = _ds.RateAmount;
indexCount++;
}
//build complete query with no filter at all
if (filterCount == 0)
{
strSQL = strSQL + orderBySQL;
tmpDS = Db.GetDataSet(string.Format(strSQL));
}
//build complete query with 1 or more filter
else
{
strSQL = strSQL + whereSQL + orderBySQL;
tmpDS = Db.GetDataSet(string.Format(strSQL, sIndex));
}
}
catch (Exception ex)
{
throw ex;
}
return tmpDS;
}
There are two mistakes in your code.
Assigning values to RptRateData.Day from CheckBoxList.
Description: You assign selected values to object without using any separator. So For example if you have selected 1, 2, 4 days then as per your code, value of RptRateData.Day will be 124. Instead of that, it should be separated with comma as shown below:
var selectedDays = string.Empty;
foreach (ListItem val in cblDay.Items)
{
if (val.Selected == true)
{
selectedDays += "'" + val.Value + "',";
}
}
RptRateData.Day = selectedDays.TrimEnd(new char[] { ',' });
Now come to the second point which is in your SQL query which you make dynamically.
Description: In this query in WHERE clause you use Like operator for ComplexRateDetailInfo.Day. This will not work anymore. Instead of that you should use IN operator.
Note: Are you sure that your Like operator is working with curly braces ('{' and '}') and without '%' symbol ?
I'm a C# newbie_and in programming in general_ and in a previous question C# return linq result as a list from a wcf service method then use it in aspx web forms page , I managed to return a row from a table and display the result in labels in my apx web forms page. Now I want to display the whole table-> an unknown number of rows. I edited my code and I was almost successful. The problem is that the table that I get, instead of the four different rows that my table contains, displays the first one four times. I check again and again but I can't find the error nor some friends. Here is my code:
staffPanel.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
displayClients_Ref.IdisplayClientsSrvcClient dcClient = new displayClients_Ref.IdisplayClientsSrvcClient();
List<string> allClients = new List<string>(dcClient.displayClients());
foreach (string row in allClients)
{
int size = 0;
string client = allClients.FirstOrDefault();
if (String.IsNullOrEmpty(client))
{
// record cannot be found
}
else
{
string[] columns = client.Split(';');
size = columns.Length;
TableRow tr = new TableRow();
allClients_tbl.Rows.Add(tr);
for (int i = 0; i < size; i++)
{
TableCell tc = new TableCell();
tc.Text = columns[i];
tr.Cells.Add(tc);
}
}
}
}
displayClient.svc.cs
public List<string> displayClients()
{
List<string> result = new List<string>();
try
{
using (paragon_db_Models.clients_Entity context = new paragon_db_Models.clients_Entity())
{
var query = from cl in context.clients
select cl;
foreach (var c in query)
{
string row = c.user_account_id + ";" + c.client_name + ";" + c.client_surname + ";" + c.business_name + ";" + c.client_address + ";" + c.postal_code + ";" + c.telephone_number + ";" + c.fax + ";" + c.email + ";" + c.fiscal_code + ";" + c.public_fiscal_service;
result.Add(row);
}
}
return result;
}
catch (Exception)
{
return result;
}
}
If it is a simple, stupid little mistake that I cannot see I will remove the question. I'm open to suggestions and comments concerning a different way of doing this.
You don't need
string client = allClients.FirstOrDefault();
You are already getting the info you want with "row" in
foreach (string row in allClients)
Replace your "client" instances with "row". FirstOrDefault would always get the first object or null.
I am a bit in a pickle regarding a consolidation application we are using in our company. We create a csv file from an progress database this csv file has 14 columns and NO header.
The CSV file contains payments (around 173 thousand rows). Most of these rows are the same except for the column amount (last column)
Example:
2014;MONTH;;SC;10110;;;;;;;;EUR;-6500000
2014;01;;SC;10110;;;;;;;;EUR;-1010665
2014;01;;LLC;11110;;;;;;;;EUR;-6567000
2014;01;;SC;10110;;;;;;;;EUR;-1110665
2014;01;;LLC;11110;;;;;;;;EUR;65670.00
2014;01;;SC;10110;;;;;;;;EUR;-11146.65
(around 174000 rows)
As you can see some of these lines are the same except for the amount column. What i need is to sort all rows, add up the amount and save one unique row instead of 1100 rows with different amounts.
My coding skills are failing me to get the job done within a certain timeframe, maybe one of you can push me in the right direction solving this problem.
Example code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = File.ReadAllText(#"c:\temp\test.txt");
string inputLine = "";
StringReader reader = new StringReader(input);
List<List<string>> data = new List<List<string>>();
while ((inputLine = reader.ReadLine()) != null)
{
if (inputLine.Trim().Length > 0)
{
string[] inputArray = inputLine.Split(new char[] { ';' });
data.Add(inputArray.ToList());
}
}
//sort data by every column
for (int sortCol = data[0].Count() - 1; sortCol >= 0; sortCol--)
{
data.OrderBy(x => x[sortCol]);
}
//delete duplicate rows
for (int rowCount = data.Count - 1; rowCount >= 1; rowCount--)
{
Boolean match = true;
for (int colCount = 0; colCount < data[rowCount].Count - 2; colCount++)
{
if(data[rowCount][colCount] != data[rowCount - 1][colCount])
{
match = false;
break;
}
}
if (match == true)
{
decimal previousValue = decimal.Parse(data[rowCount - 1][data[rowCount].Count - 1]);
decimal currentValue = decimal.Parse(data[rowCount][data[rowCount].Count - 1]);
string newStrValue = (previousValue + currentValue).ToString();
data[rowCount - 1][data[rowCount].Count - 1] = newStrValue;
data.RemoveAt(rowCount);
}
}
string output = string.Join("\r\n",data.AsEnumerable()
.Select(x => string.Join(";",x.Select(y => y).ToArray())).ToArray());
File.WriteAllText(#"c:\temp\test1.txt",output);
}
}
}
Read the CSV file line by line, and build an in-memory dictionary in which you keep the totals (and other information you require). As most of the lines belong to the same key, it will probably not cause out of memory issues. Afterwards, generate a new CSV based on the information in the dictionary.
As I interpret your question, your problem and the solution you are asking for are how to take your input that are in the form of
#"2014;MONTH;;SC;10110;;;;;;;;EUR;-6500000
2014;01;;SC;10110;;;;;;;;EUR;-1010665
2014;01;;LLC;11110;;;;;;;;EUR;-6567000
2014;01;;SC;10110;;;;;;;;EUR;-1110665
2014;01;;LLC;11110;;;;;;;;EUR;65670.00
2014;01;;SC;10110;;;;;;;;EUR;-11146.65"
Get the last column and then sum it up? If so this is actually very easy to do with something like this
public static void Main()
{
string input = #"2014;MONTH;;SC;10110;;;;;;;;EUR;-6500000
2014;01;;SC;10110;;;;;;;;EUR;-1010665
2014;01;;LLC;11110;;;;;;;;EUR;-6567000
2014;01;;SC;10110;;;;;;;;EUR;-1110665
2014;01;;LLC;11110;;;;;;;;EUR;65670.00
2014;01;;SC;10110;;;;;;;;EUR;-11146.65";
var rows = input.Split('\n');
decimal totalValue = 0m;
foreach(var row in rows)
{
var transaction = row.Substring(row.LastIndexOf(';') +1);
decimal val = 0m;
if(decimal.TryParse(transaction, out val))
totalValue += val;
}
Console.WriteLine(totalValue);
}
But maybe I have misunderstood what you were asking for?
Sorry answering my post so late but this is my final solution
Replacing all " characters and write the output to the stream writer. (going from 25mb to a 15mb file.). Than copy my CSV file to the SQL server so i can bulk insert. After my insert i just query the table and read / write the result set to a new file. My new file is only +/-700KB!
The Filldata() method is filling a datagridview in my application so you can review the result instead of opening the file in excel.
I am new with C#, i am currently writing a new solution to query the csv file directly or in memory and write it back to a new file.
Method1:
string line;
StreamWriter sw = new StreamWriter(insertFile);
using (StreamReader sr = new StreamReader(sourcePath))
{
while ((line = sr.ReadLine()) != null)
{
sw.WriteLine(line.Replace("\"", ""));
}
sr.Close();
sw.Close();
sr.Dispose();
sw.Dispose();
File.Copy(insertFile, #"\\SQLSERVER\C$\insert.csv");
}
Method2:
var destinationFile = #"c:\insert.csv";
var querieImportCSV = "BULK INSERT dbo.TABLE FROM '" + destinationFile + "' WITH ( FIELDTERMINATOR = ';', ROWTERMINATOR = '\n', FIRSTROW = 1)";
var truncate = #"TRUNCATE TABLE dbo.TABLE";
string queryResult =
#"SELECT [Year]
,[Month]
,[Week]
,[Entity]
,[Account]
,[C11]
,[C12]
,[C21]
,[C22]
,[C3]
,[C4]
,[CTP]
,[VALUTA]
,SUM(AMOUNT) as AMOUNT
,[CURRENCY_ORIG]
,[AMOUNTEXCH]
,[AGENTCODE]
FROM dbo.TABLE
GROUP BY YEAR, MONTH, WEEK, Entity, Account, C11, C12, C21, C22, C3, C4, CTP, VALUTA, CURRENCY_ORIG, AMOUNTEXCH, AGENTCODE
ORDER BY Account";
var conn = new SqlConnection(connectionString);
conn.Open();
SqlCommand commandTruncate = new SqlCommand(truncate, conn);
commandTruncate.ExecuteNonQuery();
SqlCommand commandInsert = new SqlCommand(querieImportCSV, conn);
SqlDataReader readerInsert = commandInsert.ExecuteReader();
readerInsert.Close();
FillData();
SqlCommand commandResult = new SqlCommand(queryResult, conn);
SqlDataReader readerResult = commandResult.ExecuteReader();
StringBuilder sb = new StringBuilder();
while (readerResult.Read())
{
sb.Append(readerResult["Year"] + ";" + readerResult["Month"] + ";" + readerResult["Week"] + ";" + readerResult["Entity"] + ";" + readerResult["Account"] + ";" +
readerResult["C11"] + ";" + readerResult["C12"] + ";" + readerResult["C21"] + ";" + readerResult["C22"] + ";" + readerResult["C3"] + ";" + readerResult["C4"] + ";" +
readerResult["CTP"] + ";" + readerResult["Valuta"] + ";" + readerResult["Amount"] + ";" + readerResult["CURRENCY_ORIG"] + ";" + readerResult["AMOUNTEXCH"] + ";" + readerResult["AGENTCODE"]);
}
sb.Replace("\"","");
StreamWriter sw = new StreamWriter(homedrive);
sw.WriteLine(sb);
readerResult.Close();
conn.Close();
sw.Close();
sw.Dispose();