none
vb.net - insert datepicker into sql server conversion error RRS feed

  • Question

  • Hello,

    I am trying to insert data from TextBoxes and a Date Picker into a sql server table:

    SQL.AddParam("@duedate", dtpDueDate.Value.ToShortDateString)

    But I get the following error:

    Conversion failed when converting the nvarchar value 'ID' to data type int.

    'DueDate' type in database is 'date'.

    Any input greatly appreciated.

    Savalan

    Wednesday, June 27, 2018 12:31 AM

Answers

  • Hi Savalan,

    Could you please share a complete code and related database table structure,  which I could reproduce the issue the issue on our issue on my side, if possible, please share a simple sample via OneDrive, it will be beneficial to resolve the issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Savalan Wednesday, June 27, 2018 1:55 PM
    • Unmarked as answer by Savalan Wednesday, June 27, 2018 1:55 PM
    • Marked as answer by Savalan Wednesday, June 27, 2018 2:04 PM
    Wednesday, June 27, 2018 8:09 AM
    Moderator

All replies

  • Hi Savalan,

    Welcome to the MSDN forum.

    Refer to your description, your issue is about the Data Provider. Since our forum is to discuss the VS IDE, I will help you move this thread to the appropriate forum: https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataproviders for a better support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, June 27, 2018 1:59 AM
  • Sorry. I didn't know exactly which forum I supposed to select.
    Wednesday, June 27, 2018 4:43 AM
  • Hi Savalan,

    Could you please share a complete code and related database table structure,  which I could reproduce the issue the issue on our issue on my side, if possible, please share a simple sample via OneDrive, it will be beneficial to resolve the issue.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Savalan Wednesday, June 27, 2018 1:55 PM
    • Unmarked as answer by Savalan Wednesday, June 27, 2018 1:55 PM
    • Marked as answer by Savalan Wednesday, June 27, 2018 2:04 PM
    Wednesday, June 27, 2018 8:09 AM
    Moderator
  • Hi Wu,

    Thank you for reply. I created a basic Form with a Datetimepicker and a Button, connected to server and was able to Insert, Update and Delete with no errors which I should have done before posting in the forum. Right now I am going through my code to find the cause of error. If I wasn't able to fix the issue, I will repost.

    Best regards,

    Savalan

    Wednesday, June 27, 2018 2:04 PM