The number of rows affected by .net updating the access database is 0

When updating the Access database, it is clear that the incoming data and parameter types are correct, but it has not been updated, and the number of rows affected is always 0.

The reason for this is that when C# operates an Access database, the updated parameters and conditional parameters should be set in the order in the update statement. If the settings are incorrect, the above problems will occur

 1 update TPersonnel 
 2    set pname=@pname,
 3        shenfhm=@shenfhm,
 4        sex=@sex,
 5        phone=@phone,
 6        weixing=@weixing,
 7        pid=@pid,
 8        email=@email,
 9        address=@address,
10        editer=@editor 11         editdate = @editdate 12 where id = @id _
  
  

Just like the above, the @id parameter should be at the end of all parameters, that is to say, the condition parameter should be after the update parameter

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324974868&siteId=291194637
Recommended