Hi guys,
i would like to know how to Filter selected date from calendar to display chart reading from database using web application from visual studio aspx page
Is there a way to do it?
i would like to know how to Filter selected date from calendar to display chart reading from database using web application from visual studio aspx page
Is there a way to do it?
You could use JQuery DatePicker or Asp.net Calendars control to selected date. Please refer to the following links:
Then, refer to the following code to filter data from database:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("SELECT * from table where [Date] between @SD and @ED", con))
{
com.Parameters.AddWithValue("@SD", txtfromDate.Text);
com.Parameters.AddWithValue("@ED", txttodate.Text);
using (SqlDataReader reader = com.ExecuteReader())
{
while (reader.Read())
{
int id = (int) reader["iD"];
string desc = (string) reader["description"];
Console.WriteLine("ID: {0}\n {1}", iD, desc);
}
}
}
}
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("SELECT * from table where [Date] between @SD and @ED", con))
{
com.Parameters.AddWithValue("@SD", txtfromDate.Text);
com.Parameters.AddWithValue("@ED", txttodate.Text);
using (SqlDataReader reader = com.ExecuteReader())
Member
6 Points
50 Posts
Filter selected date from calendar to display chart reading from database
Mar 24, 2017 08:19 AM|JovanYong|LINK
Hi guys,
i would like to know how to Filter selected date from calendar to display chart reading from database using web application from visual studio aspx page
Is there a way to do it?
All-Star
45489 Points
7008 Posts
Microsoft
Re: Filter selected date from calendar to display chart reading from database
Mar 25, 2017 03:27 AM|Zhi Lv - MSFT|LINK
Hi JovanYong,
You could use JQuery DatePicker or Asp.net Calendars control to selected date. Please refer to the following links:
https://jqueryui.com/datepicker/
https://www.tutorialspoint.com/asp.net/asp.net_calenders.htm
Then, refer to the following code to filter data from database:
More details, see:
https://www.codeproject.com/Questions/556502/Howplustoplussearchplusaplusrecordplusfromplusdata
Finally, refer to the following links to create a chart.
https://www.aspsnippets.com/Articles/Create-ASPNet-Chart-Control-from-Database-using-C-and-VBNet-Example.aspx
Best regards,
Dillion
Member
6 Points
50 Posts
Re: Filter selected date from calendar to display chart reading from database
Mar 28, 2017 01:28 AM|JovanYong|LINK
Where does your strConnect leads to?
Member
6 Points
50 Posts
Re: Filter selected date from calendar to display chart reading from database
Mar 28, 2017 01:49 AM|JovanYong|LINK
Thanks alot! You help me alot (: !!!!!!