Hopefully my description is a little better than the title, but basically I'm having an issue with one part of a new application schema and i'm stuck on what is the most manageable and elegant solution in table structure.
Bare bones table structure with only relevant fields showing would be as follows:
airline (id, name, ...)
hot...
I am trying to get the list:reference field type to work for web2py, but for some reason I am getting an error. I am trying the example on http://web2py.com/book/default/chapter/06:
db.define_table('tag',Field('name'),format='%(name)s')
db.define_table('product',
Field('name'),
Field('tags','list:reference tag'))
When I try th...
Hi,
I have a similar problem.
I want to make two inserts in the same transactionscope. The objects are related and have a FK relationship between them, but for several reasons I do not want to connect them via the navigation property, but only by ID.
This is a simplification of what I what I want to accomplish:
Order o = new Order();...
On the back end I am using XML files, xsd schemas a DataSet(dsThingPrograms) and DataTables. I have a parent ->child table relationship defined through the DataSet designer as such:
things[RFID(pkey), name]
programs[ID(pkey/autogen), name, path, thing_RFID(FK references things->RFID)]
In my code I have:
dsThingPrograms.things.Addthin...
In a database, one may create a many-to-many relationship between tables by creating a third table which maps the two together using foreign keys. What is the relationship between the third table and the two original tables?
For example, if table A and table B have a many-to-many relationship and table AB is the pivot table, is the A->...
I have two tables. A users table and a profile table. The profile table has a foreign key of users_id. The models for the tables are set up with one to one relationships. When I try and save some data I get this error:
Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[23000]: Integrity constrai...
I have been trying to brainstorm this with little success. The practice around here is to have the business object reflect the database table schema, since that follows the business "structure". For example the Parent table would have an ID, FirstName, and LastName column. Therefore the .NET class will have an id (to know how to communin...
I have the database table page with the fields contenttype_id and content_id. I want to link a page to a contenttype via contenttype_id and refer to an actual content via content_id. The problem is contents depend on the contenttype_id and are modelled differently, therefore the content_id refers to different tables depending on the cont...
I am trying to override save in the modelform to add the current user as the owner of a vehicle. But I am receiving 'NoneType' object has no attribute 'user'
What am I forgetting?
forms.py:
class VehicleForm(ModelForm):
class Meta:
model = Vehicle
exclude = ('slug', 'owner', )
def __init__(self, *args, **kwargs...
The context of the question is ASP.NET MVC2 / EF4. I have a number of lookup tables in the database which have previously been programmatically referenced, each from a number of other tables... So there might be a country table with country-id shortcode, desc, and half a dozen tables that have a countryid in them. Repeat for 5 or 6 other...
Hi,
Can someone tell me, how I can access all contacts relating to a specific group? I'm new to Django and did this (according to the docs):
def view_group(request, group_id):
groups = Group.objects.all()
group = Group.objects.get(pk=group_id)
contacts = group.contacts.all()
return render_to_response('manage/view_group...
Hi folks,
I've got the following entities on my EDMX :-
These two entites were generated by Update Model From Database.
Now, notice how my country has the following primary key :-
Name & IsoCode
this is because each country is UNIQUE in the system by Name and IsoCode.
Now, with my States ... it's similar. Primary Key is :-
Name ...
I have two tables, tabSparePart and tabSparePartCategory. Every spare part belongs to a spare part category. I need all spare parts that belong to a specific category. But the problem is that a spare part category could be a "subcategory" of another, they reference each other (the "main categories" have 'null' in this FK column).
Let's...
I recently began using Fluent Nhibernate for my data layer and have come across an issue. Whenever i want to delete a record that has multiple foreign key constraints, i have to create another class just to represent that database entity. That means that for something like a User record, which has relationships with many other tables, ...
I have an idea of how to fix this but I was wondering what the best way to go about this.
So one Question can have multiple Answers
Question and Answers can have points
A user is only allowed to give points per question/answer
Question:
id
title
Answer:
id
question_id
response
Points:
id
user_id
question_id
answer_i...
Hi there, I have a Lead and a custom object called Social Account (API Name = Social_Account__c).
I have set a relationship as follows: Lead is a parent of Social Accounts. so a lead has many social accounts.
In the Social Account, I made a custom field named Lead (Data Type: Lookup) to make the relationship.
and here is a lookup deta...
Hi there, I am getting an error message when I try to instert a custom object into an exisiting lead object.
List<Lead> leads =[select Id from Lead where Email =:lead.Email ];
if(leads.size()>0)
{
Lead existing_lead = new Lead(Id = leads[0].id);
social_account.Lead__c = existing_lead.Id; //social_account is a custom object that
...
Hello all!
http://img839.imageshack.us/img839/8241/stackoverflow.png
I created a new databese. There are 2 tables class and teacher. There is a field class_leader in the table class related with teacher_id from teacher. [1]
In PHPMyAdmin relationship looks like: [2]
Table teacher contains some records. [3]
When I add new records at ...
Hi,
I have 2 tables named T1 and T2. Where T1 is parent and T2 is child.
The scenario is, I started a jdbc transaction and then insert a row in T1 and then try to insert a row in T2. Inserting row in T2 gies me "Integrity Constraint-Parent key not found" exception.
How i handle this scenario ?
Connection con;
try{
con = ConnectionP...
Using ADOdb Active Record's One-to-Many relations, can I set a relation which use another database? Using "manual relations", I can load them whitout problem since each Model has it's own database prefix.
...