locked
TableAdapter Problem RRS feed

  • Question

  • Hi Everybody,

    In VisualStudio I have a tableadapter loading my *.mdb database.

    The problem is that when i have started, my "Phone" field was on Int.16, but now i nedd to change it to Int.64

     

    I have already tried to change on DataSetDesigner and on mdb database, but when i press "Insert" button i got this message:

    "Failed to convert parameter value from a Int64 to a Int16."

     

    Anyone can help me with this error ?

     

    Thanks a lot

    Thursday, June 3, 2010 7:41 PM

Answers

  • Hi LeandroMoinho,

    Then I think you need to re-configure the TableAdapter. The data type of the parameter "Phone" in the insert command of the TableAdapter is still "Int.16" if you do not re-configure the TableAdapter. You can check it in yourDataSet.Designer.vb file, find something like "Me._adapter.InsertCommand.Parameters.Add(,,,)", look the data type for parameter "Phone".

    In DataSet designer, right click on the TableAdapter --> click "Configure..." --> rechoose the columns you need including "Phone" column.

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by LeandroMoinho Friday, June 11, 2010 8:06 PM
    Friday, June 11, 2010 3:14 AM
  • Hi LeandroMoinho,

    Please follow these steps:

    Click "Data Sources" window --> Right click on the dataset --> Click "Configure Data Source With Wizard" --> Choose the tables and columns you want in the wizard

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Alex Liang Thursday, June 10, 2010 10:45 AM
    Wednesday, June 9, 2010 2:52 AM
  • Every day you learn again in this forum, I did not know the method Alex shows,

    I did before that forever  (and probably keep doing it because it are less clicks)

    Open Solution Explorer, click on the xsd to open it again, right click on it and do configure

     


    Success
    Cor
    • Marked as answer by Alex Liang Thursday, June 10, 2010 10:45 AM
    Wednesday, June 9, 2010 5:25 AM

All replies

  • Phone numbers are not typically stored as numeric values. Is there a reason why you are doing this?
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, June 3, 2010 7:57 PM
  • I think that you need to change at the back-end too. Change the Data Type in your SQL Server Database/Table column to BigInt. And try again.
    Only performance counts!
    Thursday, June 3, 2010 8:00 PM
  • It was a mistake set that field as numeric. Now I want to change it, but VB does not update de changes.
    Thursday, June 3, 2010 8:55 PM
  • I have already changed my column to BigInt, but VB does not "load" again the field type. I have changed in the Dataset Designer. But at the code, it doesn't change.
    Thursday, June 3, 2010 8:58 PM
  • Hi LeandroMoinho,

    Did you choose to copy the database file to your project when you add data source to the project ? If you did, did you modify the data type of "Phone" field in the original mdb database or the copied one in your project ?

    Best regards,
    Alex Liang 


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Monday, June 7, 2010 4:15 AM
  • If you use ADONET with drag and drop (strongly typed dataset), then open the dataset in the desinger, click right on it and choose configure again.

     


    Success
    Cor
    Monday, June 7, 2010 5:59 AM
  • I choose not to copy, and my database is on drive C.

    I've changed the field on database and dataset designer, but when on the code I write "xxxTableAdapter.Insert(" the filed phone that he wats is Int16.

    Tuesday, June 8, 2010 8:02 PM
  • Sorry, but I can't find the "Configure again" button/option that You have mentioned . Can you specify where it is ?
    Tuesday, June 8, 2010 8:16 PM
  • Hi LeandroMoinho,

    Please follow these steps:

    Click "Data Sources" window --> Right click on the dataset --> Click "Configure Data Source With Wizard" --> Choose the tables and columns you want in the wizard

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Alex Liang Thursday, June 10, 2010 10:45 AM
    Wednesday, June 9, 2010 2:52 AM
  • Every day you learn again in this forum, I did not know the method Alex shows,

    I did before that forever  (and probably keep doing it because it are less clicks)

    Open Solution Explorer, click on the xsd to open it again, right click on it and do configure

     


    Success
    Cor
    • Marked as answer by Alex Liang Thursday, June 10, 2010 10:45 AM
    Wednesday, June 9, 2010 5:25 AM
  • I have already done that, but at the code, it continues to ask me for a Int16 value.

    But on DataSet designer and on database, the value is Int64.

    I don't know what to do, to solve this problem

    Thursday, June 10, 2010 9:13 PM
  • I didn't have found the Configure function. Thanks for the help.
    Thursday, June 10, 2010 9:15 PM
  • Hi LeandroMoinho,

    Then I think you need to re-configure the TableAdapter. The data type of the parameter "Phone" in the insert command of the TableAdapter is still "Int.16" if you do not re-configure the TableAdapter. You can check it in yourDataSet.Designer.vb file, find something like "Me._adapter.InsertCommand.Parameters.Add(,,,)", look the data type for parameter "Phone".

    In DataSet designer, right click on the TableAdapter --> click "Configure..." --> rechoose the columns you need including "Phone" column.

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by LeandroMoinho Friday, June 11, 2010 8:06 PM
    Friday, June 11, 2010 3:14 AM
  • Hi LeandroMoinho,

    Then I think you need to re-configure the TableAdapter.

    In DataSet designer, right click the TableAdapter --> Click "Configure.." --> Rechoose the columns you need --> Click Next --> Click Next --> Click Finish.

    Best regards,
    Alex Liang


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, June 11, 2010 5:29 AM