CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Posts
    14

    problem with INSERT INTO command

    Hello Readers,

    I'm facing problem in one of my different INSERT command. the code is:

    Code:
    sql = "INSERT INTO DayWiseRoster (id) select UserOFTheMonth (id) where emp_id='" & txtempid.text & "'"
    This command prompting: DATA TYPE MISMATCHED.

    Couldnt find what the problem is. I need such code for data validation. I guess passing integer value with reference of another integer value creates the problem. Is there any different SQL code for passing integer value.

    the same command i used in my program for different table. That one is:

    Code:
    ssql=" INSERT INTO UserOfTheMonth (emp_id) SELECT users (Emp_id) where name='" & cboname.text & "'"
    Its working fine but the first one is creating problem. Can any one rid me of it??
    Please.....


    regards

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: problem with INSERT INTO command

    Welcome to the forum
    What database are you using?

  3. #3
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: problem with INSERT INTO command

    What are the field definitions of "UserOFTheMonth (id)" and "DayWiseRoster (id)" Are they exactly the same?

  4. #4
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: problem with INSERT INTO command

    My guess is that emp_id is an interger or a long integer, so the string delimiter should be removed.

    Code:
    sql = "INSERT INTO DayWiseRoster (id) select UserOFTheMonth (id) where emp_id= " & clng(txtempid.text)

  5. #5
    Join Date
    Feb 2009
    Posts
    14

    Re: problem with INSERT INTO command

    hello d.paulson,

    Thank you very much for the support.

    regards,

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured