//*****删除记录函数
private sub DeleteRecord(byvael strid as string)
dim DGRidItems as datagriditem
'create is a checkbox
dim ckb as checkbox
for each DGRidItems in dgrid.items
ckb=(CheckBox)DGRidItems.items.cell[0].findcontrol("ckball");
if ckb.checked==true then
//***调用删除函数
Delete(strid);
end if
next
end sub
……前面略吧,关键是以下
for i=0 to mydg.items.count-1
chk=mydg.items(i).cells(0).findcontrol("checkdel") '假设checkbox id为checkdel
if chk.checked then
dim id as string=cstr(mydg.items(i).cells(1).text)
conn.open()
sqlstr="delete from link where link_id=" & id 'link_id为你数据库中字段
cmd=new oledbcommand(sqlstr,conn)
cmd.executenonquery
conn.close()