Home > Net >  ExecuteNonQuery update, insert, delete successful, no update database table
ExecuteNonQuery update, insert, delete successful, no update database table

Time:11-25

Access database, vs2017

Public int ExecSQLResult (string SQL)
{
OleDbCommand command=new OleDbCommand (SQL, SQLCon);//specified to execute the SQL statement
If (SQLCon. State==ConnectionState. Closed)//if the current data connection Closed
SQLCon. The Open ();//open the database connection
Int result=command. ExecuteNonQuery ();//executing SQL statements
SQLCon. Close ();//close the database connection
return result;//return the number of rows affected
}


Prodata. ExecSQLResult (" UPDATE value for User_Login SET RemName=0 ");
Prodata. ExecSQLResult (" UPDATE value for User_Login SET RemName=1 WHERE ID="+ SN +" ");
Prodata. ExecSQLResult (" INSERT INTO User_Log (User_ID, Date_Log) VALUES (" + SN + "'" + DateTime. Now + ") ");

Execution is the value of returns rows, but not update the database

Through the breakpoint copy the SQL statements directly in the SQL execution box can update the database

  •  Tags:  
  • C#