Error 3031 mapping fragments starting at line 439:Non-nullable column - sql

Error 3031: Problem in mapping fragments starting at line 439:Non-nullable column D_LINK.CARTON_QTY in table D_LINK is mapped to a nullable entity property.
I have a view D_LINK with a column
CARTON_QTY(int, not null)
I dont understand where is my problem
do i have to make it null \ how?

refresh the table in your edmx from your database (In model browser, right-click-->Update Model From database --> update tab --> select your table -->click update)

The error says that your column in the table / view is not nullable but the property of the class in entity model is nullable. They must both be either nullable or not nullable.

Just delete that particular table from the model and add it again. That will solve your problem.

I got this issue after changing a none-nullable column to a nullable one.
What solved it for me was the following:
Manually edit the column and the link the column had to another table to (0...1) in the .edbx file.
After the manual edit do a update table like DRM described.
One of the actions alone did not solve my problem(feels like a glitch). Hope this can help someone.

This is on EF 4.5 that I am finding this, previous versions may not have this exact problem.
DRM mentions the way to update it, but I have found that sometimes even when you update it some of the minor changes like switching required fields or changing the field names it doesn't change them in the edmx even though you update it. Therefore your data models don't match the database exactly.
I have found the best way to ensure your edmx entity models are correct is to delete the edmx and re-add it. After doing the database first approach on EF 4.5 I think that Entity seems to play more nicely with the code first approach instead of database first.

If you want to keep the record. Only undo removes the error otherwise rebuilt table

I got it solved by
1. Delete the particular tables from the model
2. Right click on the model, select Update model from the database, select the deleted tables and click finish.

Related

Not existing column in the current network's table but still visible in the column selection

I have imported data table to my cytoscape map for the following continuous mapping accorging to values. After some time, I have imported another data table and then deleted the previous one. The original data are not present in either the node or edge table but I still can see the names of the original columns when selecting column for continuous mapping i. g. for size or colour. Moreover, this warning appears: "The current table does not have the selected column. Please select another column." Do you know how to solve this so that I no longer see the names when these columns are not even in the table?
I would be grateful for any ideas.
I have tried to delete the data table and import the data again but it didn't help. I have also tried to clone current network and import data to the new map, but the old names are still present in the column selection.
Do you know how to solve this so that I no longer see the names when these columns are not even in the table?
I would be grateful for any ideas.
A couple points and then a couple suggestions:
The style is going to "remember" the selected column name, even if you delete it since it doesn't know what to change it to. It will add a warning icon mentioning that the column is missing. You have to choose a new column (or reload the missing column) to address that issue. [I think you know this already, but just stating for completeness :)]
The pulldown list of column names should be updated when you delete table columns. This does indeed sound like a bug.
Are you running the latest Cytoscape 3.9.1?
Have you tried selecting another style and then returning back to this style? That might "refresh" the column name list.
Have you tried saving/restoring the session?

'Update requires a valid UpdateCommand when passed DataRow collection with modified rows.'

In my application I have three tables all from the same Access database. I have used the Wizard in Visual Studio Express 2019. This is an extension of my unresolved question here.
Database.TwixBindingSource.EndEdit()
Database.NPCsBindingSource.EndEdit()
Database.EffectsBindingSource.EndEdit()
Database.TableAdapterManager.UpdateAll(Database.DatabaseDataSet)
I have these three tables ("Twix","NPCs",and "Effects"). The above code automatically runs every 15 seconds, like an autosave feature. My issue is when I try to edit "NPCs" or "Effects" I recieve the following error:
'Update requires a valid UpdateCommand when passed DataRow collection
with modified rows.'
Most of the online answers in regard to this error are solved by ensuring each table has a Primary Key column that is recognised by Visual Studio in order to automatically generate the necessary commands to edit, updte, delete etc.
However, I am stumped because I have PKs on each table.
The only thing I can think is that it has something to do with the 'TableAdapterManager,'
ALthough I have no clue at this point.
EDIT: I have replaced the UPDATE ALL with individual UPDATES, but the same problem persists...
Database.TwixBindingSource.EndEdit()
Database.TwixTableAdapter.Update(Database.DatabaseDataSet)
Database.NPCsBindingSource.EndEdit()
Database.NPCsTableAdapter.Update(Database.DatabaseDataSet)
Database.EffectsBindingSource.EndEdit()
Database.EffectsTableAdapter.Update(Database.DatabaseDataSet)
Right click on your tableadapter (on the header, not the Fill command), and choose Configure
Click Advanced Options and verify that "Generate I/U/D" is ticked
When this isn't ticked, the resulting TA doesn't have any DML statements built:
If your SELECT statement doesn't select the column that is set as the primary key in the database, then this Generate IUD tickbox may be greyed out, or it will be ticked but the DML statements won't generate. Pay attention to the final page of the wizard. Here is what happened when I made a table "Other" that had no primary key:
INSERT generates, because it's easy to generate an insert on a keyless table, but update and delete cannot be generated
If you don't select the PK column you get a warning:
It's important that your DB tables have a PK; it's not the same thing to declare some datacolumns of a datatable in a dataset to be a primary key. A Dataset is not a database; it may have more or fewer tables/columns and the presentation and datatypes of row data do not have to match the DB. I can see that your dataset screenshot shows some tables have PKs declared in the DataSet side, but this is not a statement that they are definitely PKs on the DB side
Feel free to delete the DataTable; it will delete the TableAdapter too. You can then recreate that one TA by right click, new, tableadapter.. SELECT * FROM table
If you hadn't already realized, remember that you can (and should) declare more queries per tableadapter than just keeping with the basic Fill, which appears to be a SELECT * FROM without a WHERE clause in your case. Personally I always make my first query SELECT * FROM table WHERE id = #id because it's really rare that you want to download a whole table.. You can leave the default as a WHEREless query, but consider adding others, such as SELECT * FROM Twix WHERE Location = #location and naming the query FillByLocation. In code you can then fill just the locations you want, rather than downloading 10000 Twixes into the app just to show some of them (with a rowfilter, i guess)
This question and answers helped me figure out my problem.
NOTE that if your problem is your table (for example you forgot to set a primary key and you go back and fix it in SSMS while debugging) you will need to find the menus in Caius answer, ensure boxes are ticked, and hit Finish if nothing else.
This will refresh something about the statements(unclear what), and allow this to work. Otherwise you will continue to receive these errors as if you'd fixed nothing, and probably continue to search to no avail.

Column Hardware_ID get's automatically renamed to Hardware-ID

can someone explain why this happens?
I don't like to call the column [Hardware-ID] if I can help it because I have to add brackets in my code if I use the dash... but it seems if I name id anything else (I tried dbhardwareid as well as Hardware_ID), I leave the table in a seemingly inconsistent status where the select shows a name different than the design view.
I deleted and recreated the table a number of times to no avail.
My guess is that table exists under two different schemas, perhaps you are looking under one schema in Object Explorer and different schema in Query Window. Could you verify the schema?

Error adding vfp table to existing

I copied a new version of a table into an existing vfp installation and when it then tries to access that table it comes up with a variable not found error. The old version and new version of the table appear to have the same structure. Why could this happen? Does the dbc need to be updated in some way if I copy a new version of the table in. The structure is the same, but the data in it is different.
I copied the table in in Windows Explorer.
If the DBC in the same folder as the table? If not, are they in the same relative position on the two different drives? If not, you'll get errors, though I wouldn't expect "Variable not found."
Did you bring along the FPT and CDX for the new file? Again, that's not the error I would expect, but failure to do so would cause problems.
Assuming all that is right, what's the actual line of code that's failing?
Was the table that you've copied in "freed" from it's previous DBC before copying? If not, as soon as you attempt to USE it in the new location then I believe VFP will try to locate the DBC that it belongs to.
If you believe the table structure to be identical then you might be better off leaving the existing one in place and just ZAPping it to clean it out then appending the records from the other copy... of course you might need to temporarily switch off any INSERT triggers or row-level validation if you've got anything clever happening therein such as updating a "last modified" field. AutoInc fields will also need to be handled with care too, but it doesn't sound like this is something you're expecting to do on a regular basis so shouldn't be too onerous as a one-off exercise.

Linq to SQL: How do I stop the auto generated object name from being renamed?

In visual studio 2008, when I drag a database table into my dbml screen, any tables that end with the letter s automatcially get the s removed from the dbml object. Is there any way to disable this?
Also, the collection of rows also gets an s appended to the collection property name. Is there a way to change that as well?
Thanks
You need to disable the Pluralize Table Names for the LINQ to SQL designer.
To do this navigate to Tools -> Options -> Database Tools -> O/R Designer and change the Pluralization of names to false.
Then you will need to recompile your project and it should address the naming
In a code first scenario, you can handle some problems that pop up like this on a more granular level by simply specifying the name of the table on the entity with the Table attribute:
[Table("QTPhotos")]
public class QTPhoto
What I found was, originally, we had a simple entity name "Photo," but this was conflicting with some things (with a number of our entity names), so we started qualifying them ("QT" as a sample prepend), and suddenly this problem popped up. So I bet this is because "Photo" is a recognized word ending in 'o' that does not pluralize to "..oes" (as in Potatoes), but "QTPhoto" was not, meaning it was trying to find a table named "QTPhotoes".
Simply setting the table name fixes this.