Hi again,
Something is amiss in this section of code (specifically the execute command / routine UploadStream) --
Code:
using (sql_Connection = new SqlConnection(Constants.str_SqlCon))
{
foreach (DataRow csvRow in dt_CSVData.Rows) / For each record, we're going to do a separate insert.
{
using (sql_Command = new SqlCommand("Insert Into LPR_PlateHits (" + str_FieldNames + ") VALUES (" + str_ValueNames + ")", sql_Connection))
{
foreach (DataColumn csvColumn in dt_CSVData.Columns) / For each available column, add the parameter.
{
sql_Command.Parameters.AddWithValue("@" + csvColumn.ColumnName, csvRow[csvColumn.ColumnName].ToString());
}
sql_Connection.Open();
Console.WriteLine(sql_Command.CommandText);
sql_Command.ExecuteNonQuery();
sql_Connection.Close();
}
}
}
I added the write line so I could see what it was attempting to execute...
Within VS the error is - Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll'
I googled a few reasons for this and attempted to make the pk auto increment and this didn't change the behavior...
Any idea what's going on?
Will the downloaded CSV help in this case?
Maybe shoot me some general ideas on where to look?
I am running the 2019 iterations of all the software packages to attempt to make this work...
Thanks for any input