Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
iam doing an asp.net application with c# ,i need to insert the selected date value into the database and also display in the texbox. and the main problem is when i click the button then only the calendar should display and also i need to search for the date with the month in the calendar. help me out for SQL just say me the query for inserting the selected date and time into the database
. help me out
Posted
Updated 24-Oct-11 21:48pm
v2
Comments
shek124 25-Oct-11 4:44am    
Which Calendar control are you using?

1 solution

SQL
SELECT * FROM myTable WHERE DATEPART(month, dateColumn)=DATEPART(month,'2011-04-21')
 
Share this answer
 
Comments
ashok_89 25-Oct-11 3:49am    
help me out for SQL just say me the query for inserting the selected date and time into the database. the date and time should be selected from the calendar of the asp.net application
. help me out
OriginalGriff 25-Oct-11 3:54am    
INSERT INTO myTable (dateColumn) VALUES ('2011-04-21')

What is the problem you are having to do this?
ashok_89 25-Oct-11 5:38am    
thanks a lot i have done it and ,how to pass the date and time from one asp page to the other.

this is my emp.aspx page



protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;

String dt = GridView1.SelectedRow.Cells[1].Text;
String sal = GridView1.SelectedRow.Cells[2].Text;

Response.Redirect("empupdate.aspx?dt=" + dt + "&sal=" +sal);



my second file empupdate.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{

TextBox3.Text = Page.Request.QueryString["dt"].ToString();
TextBox4.Text = Page.Request.QueryString["sal"].ToString();


}
}

what i need to change to get the date and time value in the texbox3 of the empupdate.aspx
OriginalGriff 25-Oct-11 5:47am    
The problem with that approach is that you have no control over what the user enters in the text box - it could well mess up your re-direct.
Instead, have you considered using the Session variable? http://msdn.microsoft.com/en-us/library/ms178581.aspx
It has the advantage that the Client address bar is cleaner too.
sabbi26 25-Oct-11 7:07am    
to send data from one page to another the best way is using Session variables. instead of Querystring use session variable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900