我已经用我的数据库中的信息填充了一个表,但我需要另一列,我可以在其中删除表和数据库中的条目。
我已经开始创建一个删除语句,但我不知道我需要删除一个条目吗?
到目前为止,这是我的代码...
@{
var db = Database.Open("StayInFlorida");
var sPropertyId = Request.QueryString["PropertyID"];
var roominfo = "SELECT * FROM RoomInfo WHERE PropertyID=@0";
var qroominfo = db.Query(roominfo, sPropertyId);
var droominfo = "DELETE ??? FROM RoomInfo"
if (IsPost){
var deletesingleroom = db.Query(droominfo, sPropertyId);
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link href="~/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<div id="tab2" class="tab-pane">
<h4>Room Information</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>Room Title</th>
<th>Room Type</th>
<th>Room Description</th>
<th>Delete Room</th>
</tr>
</thead>
<tbody>
@foreach (var row in qroominfo)
{
<tr>
<td>@row.RoomTitle</td>
<td>@row.RoomType</td>
<td>@row.RoomDescription</td>
<td>
<form method="post">
<button type="submit" class="btn btn-success">Delete</button
</form>
</td>
</tr>
}
</tbody>
</table>
</div>
</body>
</html>