Hi all,

I created a grid view which shows the filename and date from the database,where filename is the path of the file stored in the server.I created checkbox for the items listed.In that i can select any checkbox and need to delete the particular row.That works fine.It deletes the path of the file stored in the database.My problem is i have to delete the file stored in the server too,when the checkbox is checked and delete button is clicked.How can i do it? if anyone knows the solution please help me..

Thanks in advance

Hari

So you have to delete whole row in database?
For each row in gridview Create new command to use DELETE query statement, like;

//initialize connection..
//initialize command..
//open connection..
string query = @"DELETE FROM MyTable WHERE FileName @param";
command.Parameters.Add("@param", SqlDbType.VarChar, 50).Value = filepath; //get file file path from the cell of gridview.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.