Skip to content

Commit

Permalink
Added generate report
Browse files Browse the repository at this point in the history
  • Loading branch information
aritra24 committed Oct 30, 2019
1 parent 88d74d5 commit 570edae
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Project Management System/Project Management System/admin.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@
</Columns>
</asp:GridView>
</div>
</div>
<br />
<div style="align-content:flex-end; display:flex;">
<asp:TextBox runat="server" ID="Search"></asp:TextBox>
<asp:Button runat="server" Text="Search" OnClick="GenerateReport" />
<br />
<asp:Label ID="count" runat="server"></asp:Label><br />
<asp:GridView ID="report" runat="server"></asp:GridView>
</div>
</div>
</asp:Content>
26 changes: 26 additions & 0 deletions Project Management System/Project Management System/admin.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@ protected void Page_Load(object sender, EventArgs e)
}


protected void GenerateReport(object sender, EventArgs e)
{
using (SqlConnection con = new SqlConnection(connection))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM Projects WHERE description LIKE '%' + @comment + '%';"))
{
cmd.Parameters.AddWithValue("@comment", Search.Text);

using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);

report.DataSource = dt;
report.DataBind();

}
}
}
}
}


private void BindGrid()
{
using (SqlConnection con = new SqlConnection(connection))
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 570edae

Please sign in to comment.