dcsimg
Results 1 to 2 of 2

Thread: Problem when Insert data using OO40

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    707

    Question Problem when Insert data using OO40

    Hi

    In the Company that I work, They use OO40 Objects, I trying to insert data inside table , but return error Like
    had passing null
    See piece of code
    Code:
    ....
    .    If Not bTransCancel Then
    
                    ' Clear the database error buffer before database operation
                    gDatabase.LastServerErrReset
    
                    ' Add the values in the property sheet to the dynaset
                    mdysINTEGRA_88STIFNF_Base.DbAddNew
                    mdysINTEGRA_88STIFNF_Base.Fields("ANO_MES_REFERENCIA_88STITNF").Value = Format(DTAnoMes_Ref, "yyyymm")
                    mdysINTEGRA_88STIFNF_Base.Fields("EST_CODIGO").Value = txtEST_CODIGO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("REMETENTE_PFJ_CODIGO").Value = txtREMETENTE_PFJ_CODIGO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("MDOF_CODIGO").Value = txtMDOF_CODIGO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("SERIE_SUBSERIE").Value = txtSERIE_SUBSERIE.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("NUMERO").Value = txtNUMERO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("DT_EMISSAO").Value = txtDT_EMISSAO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("DT_ENTRADA").Value = CDate(Format(txtDT_ENTRADA.Text, "DD/MM/YYYY"))
                    mdysINTEGRA_88STIFNF_Base.Fields("IDF_NUM").Value = txtIDF_NUM
                    mdysINTEGRA_88STIFNF_Base.Fields("MERC_CODIGO").Value = txtMERC_CODIGO
                    mdysINTEGRA_88STIFNF_Base.Fields("CFOP_CODIGO").Value = txtCFOP_CODIGO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("CST_CODIGO").Value = txtCST_CODIGO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("QUANTIDADE").Value = txtQUANTIDADE.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("VL_BRUTO_PROD").Value = txtVL_BRUTO_PROD.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("VL_DESCONTO").Value = txtVL_DESCONTO.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("VL_BASE_ICMS_OP").Value = txtVL_BASE_ICMS_OP.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("ALIQ_ICMS_OP").Value = txtALIQ_ICMS_OP.Text
                    mdysINTEGRA_88STIFNF_Base.Fields("VL_BASE_ICMS_ST").Value = txtVL_BASE_ICMS_ST
                    mdysINTEGRA_88STIFNF_Base.Fields("ALIQ_ICMS_ST").Value = txtALIQ_ICMS_ST
                    mdysINTEGRA_88STIFNF_Base.Fields("VL_IPI").Value = txtVL_IPI.Text
                   '  mdysINTEGRA_88STIFNF_Base.Fields(6).Value = CDate(Format(txtDT_EMISSAO.Text, "DD/MM/YYYY"))
    
    
                    mdysINTEGRA_88STIFNF_Base.DbUpdate
    see error:
    SQL execution error, ORA-01400: não é possível inserir NULL em ("FISDEV"."FIS_ITEM_SINTEGRA_MG_88STITNF"."DT_EMISSAO")

    But before command mdysINTEGRA_88STIFNF_Base.DbUpdate, I see in immediate window

    ? mdysINTEGRA_88STIFNF_Base.Fields("DT_EMISSAO").value
    27/04/2015

    Somebody can help me ?


    Tia

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,847

    Re: Problem when Insert data using OO40

    maybe you need to convert the string to a date as is done in the line below?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width