Dear all,
I have an application sQL statement which call an SQL view. The return
dataset from the View is bind to a WinForm datagriview control.
From this datcontrol, data can be edited and updated.
What I woul like to get is that this modification goes back to the View at
SQL server side which will then update proper table.
The call method which will get that modification back is done as follow :
=====>
public static Boolean UpdateAlarm(string ConnectionString,DataSet dsSource)
{
//Connection definition
using (SqlConnection sqlConnection = new
SqlConnection(ConnectionString))
{
// Request Definition
using (SqlCommand sqlcommand = new SqlCommand())
{
sqlcommand.Connection = sqlConnection;
sqlcommand.CommandType = System.Data.CommandType.Text;
sqlcommand.CommandText = "Select * from
v_Current_Alarm";
try
{
sqlConnection.Open();
SqlDataAdapter adapter = new
SqlDataAdapter(sqlcommand);
adapter.Update(dsSource,dsSource.Tables[0].TableName);
sqlConnection.Close();
}
<===
What is strange from that is that if I Watch the dsSource object,
modification are seen inside Rows.ItemArray, but the RowsState is set to
"Unchanged"
Then my Update function of Adapter seems to not modiy anything on the back
end database.
Any ideas what I do wrong ?
regards
serge
|