Dataset trouble

FabioC10

New member
Joined
Jul 10, 2014
Messages
3
Programming Experience
3-5
Good evening,


I am developing a program for the school library but I'm stuck here with the relations of the dataset. I wish someone would give me a help to see if I have any errors in the relationships of the tables. I leave you to follow the image of the relations and errors that appear me.


Sem T?tulo.png
Capturar.PNG


I am very grateful to anyone who can help me.
 
Last edited:
Those errors refer to the designer code files of a couple of forms. For some reason, whether it be something you did or a glitch in the IDE, the DataSet and table adapter components that you added to those forms cannot be found. I think the reason is that you have a form with the same name as the project. That's always a bad idea. Two things with the same name just invites confusion.

You have code that refers to BibliotecaESAOF.BibliotecaESAOFDataSet, where BibliotecaESAOF is supposed to be the root namespace and that is named after the project by default. By adding a form with that same name, the code now interprets that name as the name of the form and can't find the type referred to. The solution is to either rename the form or rename the default namespace. The latter is the better option. To do that, open the Application page of the project properties and edit the appropriate field. I suggest using something prefixed with a "company" name, e.g. my projects are always named something like Wunnell.SomeProject.

In future, you should always avoid name clashes like this. This is an example of why it's a good idea to name forms something that indicates that they are a form, e.g. SomethingForm, SomethingWindow or Something dialogue. You'll notice that you have forms with names that exactly match names in your DataSet. That's bad. For instance, you have a Categorias table in your DataSet and that's fine because that's a table containing categories. You also have a form named Categorias. Does that form actually represent categories? No, it represents a form for viewing and editing categories, not the categories themselves. Your naming convention should reflect that.
 
Thank you for the help. Now I have other error. I started a new project with other name. "Additional information: An attempt to attach an auto-named database for file C:\Users\MasterHack10\Desktop\PAP\PAP\bin\Debug\BibliotecaESAOF.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.".
 
Back
Top