我在连接到mssql数据库的aspx页中有一个数据表,我添加了带有按钮的列以打开模式,在该模式中我想显示所选记录的结果。如何传递记录ID并运行sql查询以显示我感兴趣的字段?
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#dt1').DataTable({
"processing" : true,
"ajax" : {
"url" : "selectbasic.aspx",
dataSrc : ''
},
"columns" : [
{
"data": "ID",
},
{
"data" : "Name"
},
{
"data" : "Email"
},
{
"data" : "Address"
}, {
"data" : "UserType",
"render": function(data, type, row, meta){
if(type === 'display'){
if(data=="0"){
data="NO";
}else
{
data="SI";
}
data = data;
}
return data;
}
},
{ data : 'edit',
render : function(data, type, row) {
return '<center><a data-toggle="modal" data-target="#modaldetails"><i class="glyphicon glyphicon-edit"></i></a></center>'
}
},
]
});
</script>
<div class="modal fade" id="modaldetails" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" style="z-index: 100;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLongTitle">Edit</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
"show results here where ID=...."
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
在实践中,我想使用$ _GET ['ID']和mysql_fetch_assoc()完成php&mysql的操作,但是在asp和mssql中。谢谢