SqlParameter flag=new SqlParameter ("@Id", Sqldbtype.int,value); "@ID" parameter SqlDbType.Int parameter type value size
Flag. Value=id; Assigning a value to a parameter where value and value above are different
Cmd. Parameters.Add (flag); Parameter variables must be added to the Command object.
The SqlCommand object allows you to specify the type of operation that is performed on the database. For example, you can perform select,insert,modify and delete commands on row data in a database.
Create SqlCommand object
sqlcommand cmd = new SqlCommand ("select * from Table", conn);
Conn. Open (); int flag=executenonquery(); Conn. Close ();
ExecuteNonQuery function
The return value of the ExecuteNonQuery method that returns the number of records affected by the command.
If the command is a database update statement, the number of records being updated is returned.
Returns the number of records inserted into the database when the Insert command is executed.
If the command is expected to update the record, but the ExecuteNonQuery method returns a value of 0, the update operation failed.
C # SqlParameter SqlCommand