Hello I need to produce a form with a calendar in it The users will be able to chose a starting date and an ending date for an event. The informations should be kept in a database If someone knows an existing script or is able to make one, please shout O
Fairly simple to do... assume you want a calendar for each one but it would be easy to do it with one too <%@ Page Language="VB" %> <%@ Import Namespace="System.Data.SqlClient" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) '''' insert to db Dim sqlconn As New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionString")) Dim SqlQuery As String = "INSERT INTO yourtable (startdate, enddate) VALUES (@startdate, @endate)" Dim sqlcomm As New SqlCommand(SqlQuery, sqlconn) sqlcomm.Parameters.AddWithValue("startdate", Calendar1.SelectedDate) sqlcomm.Parameters.AddWithValue("endate", Calendar2.SelectedDate) sqlconn.Open() sqlcomm.ExecuteNonQuery() sqlconn.Close() '''' do something else End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> Start Date:<asp:Calendar ID="Calendar1" runat="server" /> End Date:<asp:Calendar ID="Calendar2" runat="server" /> <asp:Button ID="button1" runat="server" Text="submit" OnClick="button1_Click" /> </div> </form> </body> </html> Code (.Net): obviously you would want to add error handling, validation etc but its the idea