none
Error "datatype mismatch in criteria expression" using insert statement RRS feed

  • Question

  • I was developing a school software and when i was saving data entered by user i got stack and get datatype mismatch in criteria expression

    i used connecter.execute(" insert into STUDENT values ('"+label25.caption+"',............)")

    so i would appreciate with your help

    • Edited by N Bruno Tuesday, August 29, 2017 4:37 PM
    Tuesday, August 29, 2017 4:35 PM

Answers

  • What type of object is connecter and what is execute method and is this vb.net?

    If this is vb.net you should be using one of the managed data providers e.g. OleDb, SqlClient with a connection and command object, create parameters for the command object via cmd.Parameters.AddWithValue(....

    If this is not vb.net please let us know as this forum (as stated when you created this question there was text indicating this forum is vb.net only)  if for vb.net but with more intel we can either move or make suggestions.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by N Bruno Wednesday, August 30, 2017 6:20 PM
    Tuesday, August 29, 2017 5:20 PM
    Moderator

All replies

  • What type of object is connecter and what is execute method and is this vb.net?

    If this is vb.net you should be using one of the managed data providers e.g. OleDb, SqlClient with a connection and command object, create parameters for the command object via cmd.Parameters.AddWithValue(....

    If this is not vb.net please let us know as this forum (as stated when you created this question there was text indicating this forum is vb.net only)  if for vb.net but with more intel we can either move or make suggestions.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by N Bruno Wednesday, August 30, 2017 6:20 PM
    Tuesday, August 29, 2017 5:20 PM
    Moderator
  • There are examples at the below link that demonstrates how to use Command Parameters. I would not use variables in your SQL statement, as in your example, but parameter placeholders instead.

    http://www.informit.com/articles/article.aspx?p=382852&seqNum=4


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Tuesday, August 29, 2017 6:06 PM
  • I used ..

    on declarations

    global connecter as new ADODB.connection

    on dbconnection()

    set connecter =new ADODB.connection

    connecter.open ("Provider=Microsoft.Jet.OLEDB.4.0;......")

    if there is any other information needed you can let me

    and thanks for your help im getting

    Wednesday, August 30, 2017 6:37 PM
  • i checked the codes but i meant vb6 not asap.net

    don't know how it can help really

    thanks

    Wednesday, August 30, 2017 6:38 PM