i try to import csv data into sql server using window application. but i get this error while import the data.Any suggestion to fix this error?
What I have tried:
private void btnImport_Click(object sender, EventArgs e)
{
DataTable dataTable = new DataTable();
string dbconnection = @"Data Source=; Initial Catalog=Biiuty; Initial Catalog=Hbi; User Id=ida; Password=***"";
using (SqlConnection sqlConnection = new SqlConnection(dbconnection))
{
SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(sqlConnection);
sqlBulkCopy.DestinationTableName = "SIS";
sqlBulkCopy.ColumnMappings.Add("DateTime", "DateTime");
sqlBulkCopy.ColumnMappings.Add("Milliseconds", "Milliseconds");
sqlBulkCopy.ColumnMappings.Add("MachineAutoStartStop", "MachineAutoStartStop");
sqlBulkCopy.ColumnMappings.Add("Pressure", "Pressure");
sqlConnection.Open();
sqlBulkCopy.WriteToServer(dataTable);
sqlConnection.Close();
}