新增需求
删除日志也可以点击页面查看
如下
实操
1、新增button控件,并设置TEXT 名称为删除日志查询
2、显示控件利用dataGridView来显示
3、查询绑定requestid
private void button2_Click(object sender, EventArgs e)
{
string requestId = textBox1.Text.Trim(); // 获取请求ID
if (!string.IsNullOrEmpty(requestId))
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
string selectLogQuery = @"
SELECT RecordId, OperationType, OperatedDate, OperateTime, OperatedBy, ClientIp
FROM LimitoperationLog
WHERE TableName = 'workflow_requestlog' AND OperationType = 'Delete' AND requestid = @requestId
ORDER BY OperatedDate DESC, OperateTime DESC";
using (SqlCommand command = new SqlCommand(selectLogQuery, connection))
{
command.Parameters.AddWithValue("@requestId", requestId);
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataTable dataTable = new DataTable();
adapter.Fill(dataTable);
dataGridView1.DataSource = dataTable; // 假设dataGridView1是用来显示日志数据的DataGridView控件
}
}
}
else
{
MessageBox.Show("请输入请求ID!");
}
}
THE END
暂无评论内容