Refer the below code.
string date = "", type = "", card_no = "", auth_id = "", amount = "", entity_id = "", txn_type = "", Card_Type = "", RRN = "", Reff_no = "", type_card = "";
string line = "4/5/2015 05:17:15 AM| VISA| 4704560544052255| 032571| 76000| 000000023890137| DOM| Visa Platinum| 000080752769| 74662425098150981147100| D";
Array linearray = line.Split('|');
if (linearray.Length == 11)
{
date = linearray.GetValue(0).ToString().Trim();
type = linearray.GetValue(1).ToString().Trim();
card_no = linearray.GetValue(2).ToString().Trim();
auth_id = linearray.GetValue(3).ToString().Trim();
amount = linearray.GetValue(4).ToString().Trim();
entity_id = linearray.GetValue(5).ToString().Trim();
txn_type = linearray.GetValue(6).ToString().Trim();
Card_Type = linearray.GetValue(7).ToString().Trim();
RRN = linearray.GetValue(8).ToString().Trim();
Reff_no = linearray.GetValue(9).ToString().Trim();
type_card = linearray.GetValue(10).ToString().Trim();
//Cheking card type.
if (type.ToUpper() == "VISA")
{
type = "V";
}
else
{
type = "M";
}
//Cheking amount.
amount = amount.Replace(".", "");
if (amount.Length > 2)
{
amount = amount.Substring(0, amount.Length - 2) + "." + amount.Substring(amount.Length - 2, 2);
}
else if (amount.Length == 2)
{
amount = "." + amount;
}
else
{
amount = ".0" + amount;
}
//Cheking entity_id.
for (int i = 0; i < entity_id.Length; i++)
{
if (!entity_id.Substring(i, 1).Equals("0"))
{
entity_id = entity_id.Substring(i, entity_id.Length - i);
i = entity_id.Length;
}
}
//Cheking DOM.
if (txn_type.ToUpper().Equals("DOM"))
{
txn_type = "D";
}
else
{
txn_type = "I";
}
string str = "INSERT INTO clearing_txn VALUES('" + date + "','" + type + "','" + card_no + "','" + auth_id + "','" + amount + "','" + entity_id + "','" + txn_type + "','" + Card_Type + "','" + RRN + "','" + Reff_no + "','" + type_card + "')";
}
Output of str
INSERT INTO clearing_txn VALUES('4/5/2015 05:17:15 AM','V','4704560544052255','032571','760.00','23890137','D','Visa Platinum','000080752769','74662425098150981147100','D')