Jump to content
Fórum Script Brasil
  • 0

Declarações Condicionais


wagtel

Question

Estou com dificuldades para entender as "Declarações Condicionais"

Na página modelo abaixo descrita, quando o cliente clinca em "Buscar" e envia um

valor inválido ou qualquer valor diferente de Ex: 06/03/2012

a página "agenda_2.asp" que recebe aparece como:

Tipo de erro:

Erro de tempo de execução do Microsoft VBScript (0x800A000D)

Tipos incompatíveis: '[string: "dd/mm/aaaa"]'

agenda_2.asp, line 7

ou

Tipo de erro:

Erro de tempo de execução do Microsoft VBScript (0x800A000D)

Tipos incompatíveis: '[string: ""]'

agenda_2.asp, line 7

Etc...

http://www.wagtel.com/agenda_0.asp

para sanar este problema eu inseri no código ASP a declaração condicional:

<% 
Data = Date
If Request.QueryString <> "" Then

hData = Request.QueryString("Data")
aData = dateadd("d", -2, Request.QueryString("Data"))
bData = dateadd("d", -1, Request.QueryString("Data"))
cData = dateadd("d", +1, Request.QueryString("Data"))
dData = dateadd("d", +2, Request.QueryString("Data"))

Else Request.QueryString()

Response.write ("Valor Digitado Inválido")
hData = Date
aData = Date
bData = Date
cData = Date
dData = Date


End If
 %>

Mas não deu certo, alguém pode me explicar onde estou errando:

Edited by wagtel
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

experimente usar o isdate():

<%
    Dim dateString

    dateString = Now

    Response.Write(IsDate(dateString))

    dateString = "August 10, 2008 11:10 PM"

    Response.Write(IsDate(dateString))

    dateString = "8/11/2008"

    Response.Write(IsDate(dateString))

    dateString = "12:15 PM"

    Response.Write(IsDate(dateString))

    Response.Write(IsDate("IsDate Function"))
%>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...