Can any body explain me Adding parameters to AddParams method I cant understand the code
in this code it try to delete a row from article table, for that i use SqlDataAdapter,DataSet and DataTable ,
//Preparing Delete Sql Command
dataAdapter.DeleteCommand=conn.CreateCommand();
dataAdapter.DeleteCommand.CommandText="DELETE FROM article WHERE artId=@artId";
AddParams(dataAdapter.DeleteCommand,"artId");
This is the place i cant not understand
Adding Parameters to the AddParams method
private void AddParams(SqlCommand cmd,params string[] cols)
{
//Adding Hectice parameters in SQL Commands
foreach(string col in cols)
{
cmd.Parameters.Add("@"+col,SqlDbType.Char,0,col);
}
}