Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8874035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:37:15+00:00 2026-06-14T18:37:15+00:00

I have 2 calender controls ‘cldStartDate’ and ‘cldEndDate’ which link to 2 textboxes ‘txtStartDate’

  • 0

I have 2 calender controls ‘cldStartDate’ and ‘cldEndDate’ which link to 2 textboxes ‘txtStartDate’ and ‘txtEndDate. When a date is selected these textboxes hold the dates. I am trying to get my code to add the dates into my database. It has the following fields:

-ProjectName
-Description
-StartDate
-EndDate

Both ‘StartDate’ and ‘EndDate’ are of type DateTime in my database. Could someone please point out where I am going wrong in my code. I think I need to change the code to pass the date values in as DateTime. Has anyone got an idea of how I may do that. The code is below. Thanks!

Protected Sub btnAddProject_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddProject.Click

    Dim projectName As String
    Dim projectDescription As String
    Dim startdate As String
    Dim enddate As String

    projectName = txtProjectName.Text
    projectDescription = txtProjectName.Text
    startdate = txtStartDate.Text
    enddate = txtEndDate.Text

    ' check the validity of information entered
    Dim isValid As Boolean
    isValid = True

    If String.IsNullOrEmpty(projectName) Or String.IsNullOrEmpty(projectDescription)     Then
        isValid = False
    End If

    If isValid Then
        'add everything to the database
        Dim db As New AgileClassesDataContext()

        Dim startDate As String
        startDate = DateTime.Parse(startDate)

        Dim endDate As String
        endDate = DateTime.Parse(endDate)

        ' create a project to populate a row in the PROJECT table
        Dim project As New Project With _
        {.ProjectName = projectName, _
         .Description = projectDescription _
         .StartDate = startdate _
         .EndDate = enddate}

        ' add the new project to the PROJECT table
        db.Projects.InsertOnSubmit(project)

        ' submit the changes to the database
        Try
            db.SubmitChanges()
        Catch ex As Exception
            Console.WriteLine(ex)
            db.SubmitChanges()
        End Try'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:37:16+00:00Added an answer on June 14, 2026 at 6:37 pm

    I suspect the immediate problem is your syntax for the object initializer. Instead of this:

    Dim project As New Project With _
        {.ProjectName = projectName, _
         .Description = projectDescription _
         .StartDate = startdate _
         .EndDate = enddate}
    

    … you should have a comma after each property:

    Dim project As New Project With { _
        .ProjectName = projectName, _
        .Description = projectDescription, _
        .StartDate = startdate, _
        .EndDate = enddate }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net page, some of its controls are created dynamically, these controls
I have a textbox for date. It has calender control extender to select date.
i have a database with three rows id,des,date and i have a calender control
Possible Duplicate: Schedule Controls for ASP.Net MVC I have MVC3 in which I want
I have several Telerik's DropDownList controls which are rendered inside jQuery dialog It is
I am using the following code to create calendar controls on textboxes that have
i have two text box controls with calender extender and a dropdownlist as follows.
I have a problem using the calender control .. I am getting the date
i have date like string date = calarc.SelectedDate.ToString(MM/dd/yyyy); where calarc is calender control. It
I have a text box with event name and two calendar controls to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.