Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
mkboy

Insert

Question

Estou fazendo um insert no MySQL, no access funciona normal o mesmo!

Então, crei minha tabela e nela um campo DATETIME NOT NULL

c_data = now

E to fazendo o insert assim:

[ASP]SQL1 = "Insert into tb_acesso"

SQL1 = SQL1 &"(b_ip, b_data, b_status)"

SQL1 = SQL1 &"values('"&c_ip&"',"&c_data&",'"&c_status&"')"

Set RS1 = conexao.execute(SQL1)[/ASP]

Mas no banco entra valor 0000-00-00 00:00, o valor defaut!

Tenti fazer o insert direto no front e a mesma coisa!

Insert into tb_acesso(b_data)values('1/3/2005 10:18:01')

Ué!

huh.gif

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

voce tem que converter a data para o formato do mysql:

<%
data=now()
data1=split(data,"/")
datahora=split(data1(2),chr(32))
datamysql = datahora(0)&"-"&data1(1)&"-"&data1(0)&chr(32)&datahora(1)
response.write datamysql
%>

Share this post


Link to post
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.

Sign in to follow this  

Cloud Computing


  • Forum Statistics

    • Total Topics
      148107
    • Total Posts
      643383
×
×
  • Create New...