added checkbox on gridview this method:

asp:CheckBox runat="server" ID="CheckBox1" /> 

I want to save selected values another table but I did not achive.First I try this code and then I will convert this delete statement to select statement ,it deletes checked value but there is sql exception ID =@ID and keyid=@keyid"; I think this values should be primary key,but I cant set primary key in a table both of them(keyid my primary key now I need this primary key when user select one row ).Please give idea,I tried most of things and tired:(

string connStr = ConfigurationManager.ConnectionStrings["bdConnectionString"].ConnectionString; 
string sql = "Delete From ekleme Where ID =@ID and keyid=@keyid"; 
SqlConnection conn = new SqlConnection(connStr); 
SqlCommand cmd = new SqlCommand(sql, conn); 
cmd.CommandType = 
SqlParameter keyid = cmd.Parameters.Add("@keyid", SqlDbType.Int); 
SqlParameter ID = cmd.Parameters.Add("@ID", SqlDbType.Int); 
keyid.Value = Session[
string str = ""; 
for (int i = 0; i < GridView1.Rows.Count; i++) 
GridViewRow row = GridView1.Rows[i]; 
bool isChecked =((CheckBox)row.FindControl("CheckBox1")).Checked; 
if (isChecked) 
str = 
ID.Value = GridView1.Rows[i].Cells[0].Text;

your delete query is not correct

delete statement is:-

DELETE FROM tablename
WHERE LastName='name' AND FirstName='aneme'

DELETE FROM table_name
WHERE some_column=some_value

keyid=primary key in my table- coloumn name
keyid.Value = Session["keyid"];
but may be I am wrong please correct me

can you explain your error in detail?

thanks for reply.Sure I can explain
I added checkbox on gridwiev with itemtemplate actually I need selected datas (primary key is sufficient) this system is petition submission system when student want to add lecture on his schedule advisor can accept or reject his submission.I search this type questions on net and get this sample actuallay it should be work but I dont achive.
my database table:
stuid,stuname,advisor name,addlecture,droplecture,I think primary key stuid and checkbox ID can be primary key because of I see it in a forum
and this code have sql exception now :
SQL exception on cmd.ExecuteNonQuery();
""The parameterized query '(@keyid int,@ID int)Delete From ekleme Where ID =@ID and keyi=@' expects the parameter '@keyid', which was not supplied."
thanks again