INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Insert wit empty fields

Insert wit empty fields

(OP)
Hi everyone,
I try to make an insert query but some of my fields wich I want to insert must be empty and I receive an error like when they are empty:

"[Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Syntax Error: Insert into CONTACTS(typeTiers,CodeTiers,sContact_Interloc,sContact_Url,sContatc_Tel,sContact_fax)
values('',0,<<???>>,,,)"

How can I do to avoid this error?

Thanks,
Bakira

RE: Insert wit empty fields

(OP)
information:

This query should permit me to transfer data from database access to BTR.

Thanks,
Bakira
 

RE: Insert wit empty fields

You can't pass nothing.  You have to pass some value.  You might try "null" or an empty string.  Something like:
"Insert into CONTACTS (typeTiers,CodeTiers,sContact_Interloc,sContact_Url,sContatc_Tel,sContact_fax)
values ('',0,null,null,null,null)"
or
"Insert into CONTACTS (typeTiers,CodeTiers,sContact_Interloc,sContact_Url,sContatc_Tel,sContact_fax)
values ('',0,',',',')"  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Insert wit empty fields

(OP)
Thanks mirtheil,
you're, as already, give me a solution :)

However, I still have a problem...

I've 2 databases, on access database and a pervasive database
I must do a research of duplicate between this 2 databases.
I trail databases and if a duplicate is find, the row is logged else the rows is saved in the pervasive database.

The problem is that I received a bTrieve Error 5 (duplicate keys) before my test; when I placed my recordset at the top  with property MoveFirst (VB6 programation)?

can you give me some help please?

bakira

RE: Insert wit empty fields

You should never see an error 5 on a MoveFirst.  Can you post your code that returns the status 5?  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Insert wit empty fields

(OP)
This is my code :


Private Function VerifierExistence(ByRef pinout_objRecordSet As Object, ByVal pin_strNom As String, ByVal pin_strId As String, ByVal pin_strCode As String, ByVal pin_strN As String) As Integer

    
    Dim x As Integer
    'déclaration variable
    Dim intResultat As Integer 'retour du resultat (0,1,2)
    Dim blnTrouve As Boolean 'si trouvé
    
    'valeur par defaut 0, non trouvé
    intResultat = 0
    
    'positionnement au debut
    pinout_objRecordSet.MoveFirst
    
    'valeur par defaut, non trouvé
    blnTrouve = False
    
    'tant qu'one st pas a la fin ou qu'on a pas trouvé la ligne
    While pinout_objRecordSet.EOF = False And blnTrouve = False
        
        'si le doublon nom
        If StrComp(UCase(pinout_objRecordSet.Fields(pin_strN).Value), UCase(pin_strNom)) = 1 Then
            'ligne trouvé
            blnTrouve = True
            'retour 1
            intResultat = 1
        Else
            'si doublon ID
            If pinout_objRecordSet.Fields(pin_strCode).Value = pin_strId Then
                'ligne trouvé
                blnTrouve = True
                'retour 2
                intResultat = 2
            End If
        End If
        'chnagement de ligne d'enregistrement
        pinout_objRecordSet.MoveNext
    Wend
    
    'retourne la valeur
    VerifierExistenceDansBase = intResultat
    
End Function


The BTrieve error 5 is on the ligne "pinout_objRecordSet.MoveFirst"
and when I passed this ligne in comment, the error is on the "pinout_objRecordSet.MoveNext" ligne.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close