Jan 08, 2015, 12:15 PM
[CLOSED] BADRESPONSE: missing ) in parenthetical
Dear Sir,
when i upload excel sheet in localhost it's work fine without any problem , but in the server it's give me this error :
BADRESPONSE: missing ) in parenthetica
what i should do to solve this issue ?
my code :
when i upload excel sheet in localhost it's work fine without any problem , but in the server it's give me this error :
BADRESPONSE: missing ) in parenthetica
what i should do to solve this issue ?
my code :
public static void importDataFromExcel(string InvoiceNo, string excelFilePath)
{
OleDbConnection oleConnection = new OleDbConnection();
string strFileType = System.IO.Path.GetExtension(excelFilePath).ToString().ToLower();
if (strFileType.Trim() == ".xls")
{
oleConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFilePath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
}
else if (strFileType.Trim() == ".xlsx")
{
oleConnection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFilePath + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\"";
}
oleConnection.Open();
OleDbCommand oleCommand = new OleDbCommand("SELECT * From [InvoiceItems$]", oleConnection);
OleDbDataReader reader = oleCommand.ExecuteReader();
SqlConnection con = Connections.GetSQLConnection();
while (reader.Read())
{
string HSCODE = reader[0].ToString();
string Description = reader[1].ToString();
string ItemTariff = reader[2].ToString();
con.Close();
string insquery = "INSERT INTO [Translation_Provisions] ([Item], [HSCODE], [Description], [ItemTariff]) VALUES (@Item, @HSCODE, @Description, @ItemTariff)";
SqlCommand com = new SqlCommand(insquery, con);
com.Parameters.AddWithValue("@Description", Description);
com.Parameters.AddWithValue("@ItemTariff", ItemTariff);
com.Parameters.AddWithValue("@ItemDescription", ItemDescription);
com.Parameters.AddWithValue("@Item", "");
con.Open();
com.ExecuteNonQuery();
con.Close();
}
}
thank you in advance
Last edited by Daniil; Jan 16, 2015 at 9:13 AM.
Reason: [CLOSED]