I have application, which loading data from CSV to DataTable and from this populated DataTable it inserting data to MS SQL.
I found some note how to make an update, but I´m looking for the way how to avoid selecting in initializing of DataAdapter:
conn_update.Open();
string sql_q = "@"SELECT * FROM [publicDB].[dbo].[customers]"
SqlDataAdapter SQLUpdateAdapter = new SqlDataAdapter(sql_q, conn_update);
cmdBuilder = new SqlCommandBuilder(SQLUpdateAdapter);
cmdBuilder.GetUpdateCommand();
SQLUpdateAdapter.Update(treti);
First question:
Is there any way to do this update, without using Select Command when initializing SQL DataAdapter?
From this
SqlDataAdapter SQLUpdateAdapter = new SqlDataAdapter(sql_q, conn_update);
To something like this (just example, for a solution I want to find)
SqlDataAdapter SQLUpdateAdapter = new SqlDataAdapter(conn_update);
Or another way how to avoid meaningless selecting form DB?
Second (stupid) question: What is the purpose for using SqlCommandBuilder :
cmdBuilder = new SqlCommandBuilder(SQLUpdateAdapter);
cmdBuilder.GetUpdateCommand();
Thaks a lot for your answer!