none
Column ‘CB_NRP_Department’ does not belong to table Tbl_New_Employee_Database” RRS feed

  • Question

  • Many months after the original table was created, I needed to add an additional Column. Now when I try to run the program, the new column is not recognized. See the below PopulateForm Procedure below to show error. I’m getting an Exception error “Column ‘CB_NRP_Department’ does not belong to table Tbl_New_Employee_Database”. I even deleted the “xsd” New_EmployeesDataSet.xsd from the solution explorer and then recreated a new Data source. I get the same error: ‘SystemArgumentException: ‘Colum ‘CB_NRP_Department’ Does not belong to table Tbl_New_Employee_Database.

    All the original columns are recognized perfectly fine. It almost appears that once the Database is created your not

    allowed to add additional columns. Please advise.

    Monday, July 15, 2019 11:57 AM

All replies

  • Hello,

    If you used the IDE data wizard to generated classes make sure you are pointing to the correct database, may developers have targeted the wrong database more times than I can count.

    Otherwise after one of more fields are added 

    In the data source window right click on the table name, select "Configure data data source with wizard) and you should see the same thing in the image below on the employee table were I added two additional fields so the wizard picked up on them hence (partially selected)

    The following image shows the two new fields, check them and finish up.


    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, July 15, 2019 1:24 PM
    Moderator
  • Karen, thanks for your response.

    That's what I thought as well, but the field is there and checked.

    I tried to send some images, but my account hasn't been verified yet. I just created my account today. Additionally, the column is visible in the table, as well is in the DataSource.

    Monday, July 15, 2019 2:33 PM
  • If by chance the database is in the project level folder

    • Open it and verify this is the right database
    • Also make sure "Copy to output folder" is set for testing "Copy always"

    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Monday, July 15, 2019 3:04 PM
    Moderator
  • The Properties of the New_EmployeesDataSet.xsd (Copy to Output Directory) is now set to Copy always. That didn't seem to make a difference. My project code and folders are on our Network's H: drive, (My personal drive), while the Database is on a Shared server where group privileges can eventually be applied. I tried adding a record to the database through the program and the record was added successfully. So I feel that the program is "seeing" the correct database. I also noticed something unusual, If I hover my mouse over the xsd file or over one of the Forms in the solution explorer, It says "pending add". Is that referring to the field I added that isn't being recognized?

    See below for a snapshot of the error message:

    "Can not attach an image. My account is still not verified"

    Tuesday, July 16, 2019 11:07 AM
  • I would suggest making a copy of the project to your C drive, copy the database too so all work is devoid of network drives and try that.

    The "pending add" sounds like an issue on the database side, perhaps permissions if you tried this in more than one project. Have not seen this other than in SQL-Server Management Studio but not how it's happened with your code.


    Please remember to mark the replies as answers if they help and unmarked 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.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by vaper0157 Thursday, July 18, 2019 11:06 AM
    • Unmarked as answer by vaper0157 Thursday, July 18, 2019 11:06 AM
    Tuesday, July 16, 2019 1:38 PM
    Moderator