adding and editing records in a database

Results 1 to 2 of 2

Thread: adding and editing records in a database

  1. #1
    Join Date
    Dec 1969

    Default adding and editing records in a database

    Can someone out there help me?<BR><BR>I am trying to add and edit records to a database but i am running into an error.<BR><BR>In my database, I have two fields that I am having problems with. One is called Start_Date and one End_Date. Both have a datatype of Date/Time.<BR><BR>My form that I use has text boxes for these fields and they are called txtStart_Date and txtEnd_Date.<BR><BR>The error I keep getting is a type mismatch error. The code in my pages looks like this:<BR><BR>If Request.Form("btnAdd") = "Add" Then<BR>RecordSet.AddNew<BR>RecordSet.Fields("Star t_Date") = Request.Form(CDate("txtStart_Date"))<BR>RecordSet. Fields("End_Date") = Request.Form(CDate("txtEnd_Date"))<BR>RecordSet.Up date<BR>Added= "True"<BR><BR>End If<BR>%&#062;<BR><BR><BR>Someone told me to put the CDate in frnt of the txtStart_Date and txtEnd_Date.<BR><BR>But something is not right. Does anyone know what I can do to fix this. I am new to asp, so if someone could spell it out for me, I would appreciate it.

  2. #2
    Join Date
    Dec 1969
    Indianapolis, IN

    Default RE: adding and editing records in a database

    Try this:<BR><BR>RecordSet.Fields("Start_Date") = Cdate(Request.Form("txtStart_Date"))<BR>RecordSet. Fields("End_Date") = Cdate(Request.Form("txtEnd_Date"))<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts