CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2008_express Tags:
Item Type: NewsGroup Date Entered: 9/16/2007 5:48:37 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 53 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
chubbs6
Asp.Net User
Linq adding to two tables related to each other9/16/2007 5:48:37 AM

0/0

Hey,

 Im really stuck here wondering how i go about doing this.  I have two tables, one which is PrivateMessagesThreads, and PrivateMessages.

CREATE TABLE [dbo].[PrivateMessageThreads](
[ThreadID] [int] IDENTITY(1,1) NOT NULL,
[LatestMessageID] [int] NULL,
[ToUserID] [uniqueidentifier] NOT NULL,
[FromUserID] [uniqueidentifier] NOT NULL,
[IsUnread] [bit] NOT NULL CONSTRAINT [DF_PrivateMessageThreads_IsUnread] DEFAULT ((0)),
[CreatedOn] [datetime] NOT NULL,
[UpdatedOn] [datetime] NOT NULL,
CREATE TABLE [dbo].[PrivateMessages](
[PrivateMessageID] [int] IDENTITY(1,1) NOT NULL,
[ThreadID] [int] NULL,
[Subject] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Body] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreatedOn] [datetime] NOT NULL,
[FromIPAddress] [varchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[HasAttachment] [bit] NOT NULL CONSTRAINT [DF_UserPrivateMessages_IsAttachment] DEFAULT ((0)),
[IsUnread] [bit] NOT NULL CONSTRAINT [DF_PrivateMessages_IsUnread] DEFAULT ((1)),
[IsReplied] [bit] NOT NULL CONSTRAINT [DF_PrivateMessages_IsReplied] DEFAULT ((0)),
[Summary] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 
My c# LINQ code. 
PrivateMessage newMessage = new PrivateMessage();
PrivateMessageThread newThread = new PrivateMessageThread();

newMessage.FromIPAddress = fromIP;
newMessage.Body = body;
newMessage.Subject = subject;
newMessage.HasAttachment = attached;
newMessage.CreatedOn = DateTime.Now;
newMessage.Summary = body;

newThread.FromUserID = FromUserID;
newThread.ToUserID = ToUserID;
newThread.UpdatedOn = DateTime.Now;
newThread.CreatedOn = DateTime.Now;

newThread.LatestPrivateMessage = newMessage;
newMessage.Thread = newThread;

db.PrivateMessageThreads.Add(newThread);
db.SubmitChanges();

im confused now how to add new private message. i really dun understand how to a new message, cos i  need to add it to both tables to begin with.

any got any ideas, or any other ways i could go about doing this ?  
 

1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Head First C# Authors: Andrew Stellman, Jennifer Greene, Pages: 738, Published: 2007
Professional LINQ Authors: Scott Klein, Pages: 408, Published: 2008
Pro LINQ Object Relational Mapping in C# 2008 Authors: Vijay P. Mehta, Pages: 408, Published: 2008
Pro LINQ: Language Integrated Query in C# 2008 Authors: Joseph C. Rattz, Joseph C Rattz, Jr, Pages: 600, Published: 2007
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Expert F# Authors: Don Syme, Adam Granicz, Antonio Cisternino, Pages: 609, Published: 2007
Pro Asp.net 3.5 in Vb 2008: Includes Silverlight 2 and the Ado.net Entity Framework Authors: Matthew MacDonald, Mario Szpuszta, Vidya Vrat Agarwal, Pages: 1200, Published: 2008
Linq for Visual C# 2005 Authors: Fabio Claudio Ferracchiati, Pages: 163, Published: 2007
LINQ for VB 2005 Authors: Fabio Claudio Ferracchiati, Pages: 176, Published: 2007
Simply Visual Basic 2008 Authors: P. J. Deitel, Deitel & Associates ,Inc. Staff, G J Ayer, Pages: 896, Published: 2008

Web:
LINQ/SQL insert to two related tables - ASP - Web Development ... how to go about doing this. i have two tables which are related to each other, ... and each PrivateMessage is related to a thread. I am trying to use LINQ, ... Add(newThread); db.SubmitChanges(); this code however does not work, ...
LINQ to SQL - 5 Minute Overview - Hooked on LINQ Apr 24, 2008 ... You can assign, add and delete records in related tables just by ... doesn’t have foreign-key relationships defined between two tables, LINQ to SQL ... new records to the database and to correctly reference each other. ...
Introducing LINQ to Relational Data Using partial classes allows developers the flexibility to add methods, .... Querying a single Entity mapped to two tables in the database. ... NET Entity Framework also allow the mapping of two other types of inheritance. ... single table for each class, single table for all data related to specific type) ...
Easy XML to SQL Using Linq Sep 10, 2008 ... Add a new Linq to SQL Class to your project, and connect to the database which will ... We need to loop through each order in the XML file, ... using values from the other elements in our xml order segments. ... Remember that we related the two tables based on the OrderId , not the OrderNumber . ...
Linq, data binding with 2 tables : The Official Microsoft ... ... a List of Customer (in this case you get one) back and each has a list of Orders. ... It seems that the LoadWith method can only load two tables as one call if they ... As you can probably tell by the name I want to link it with other fields at .... NET Data Services - Intercepting Queries and Adding Validation ...
LINQ To SQL and Tight Coupling Part 3 Mar 10, 2008 ... Our current object model has very simple mapping of one table to one ... The table structure involves creating a foreign key between the two tables: ... Your Loader will need to add at least one method for each relation you have. ... The other way I found isn't quite as pretty, and requires the Core ...
Linq to SQl, select same column from multiple tables - Stack Overflow Basically I have a table for each kind of hardware component in a computer, and each table has a ItemNumber column. ... add comment. JavaScript is needed to access comments. ... Browse other questions tagged c# linq sql query or ask your own question. ... Related. SQL: Select like column from two tables ...
Building Multi-Tier Web Application in .NET 3.5 Framework Using ... Mar 5, 2008 ... So, we have the provision to add ASP.NET application and class library projects ... LINQ to SQL creates Entity class for each table inserted in the ..... table is related to other two tables - Department and Designation. ...
CodeProject: An introduction to LINQ for db4o. Free source code ... Apr 28, 2008 ... The 2 objects are related to each other through the property ... Because the property is of the type Office it is declaring a relation between the two objects. ... If you want to use Linq for db4o then you need to add at least 2 ..... for this query it is doing a group query on the Employee table. ...
Charlie Calvert's Community Blog : LINQ Farm: One to Many and ... These two tables are related in a parent-child relationship. ... In line 6, for instance, we can see that the join is formed on the ProductId field shared by each table. ... For more details on LINQ, see the other posts in this series. ...




Search This Site:










file encoding in visual web developer 2008

method not found: "'boolean system.web.ui.design.viewrendering.get_visible()'.

visual studio express codename "orcas" ctp released!

ide hangs when switching from source to design view

really need help

can’t scroll the design pane

error when running with asp.net 3.5

cannot insert, update or delete data

updating links

using more javascript / ajax with the new intellisense - unclear coding

recent projects not displaying my recent projects

price

beginner issues, documentation

canot get a basic ajax like site to run, seems to use .net 2.0 instead of 3.5

getting started...

framework

does dotnetnuke v4.8 work with vwd 2008 express?

parser error: could not load type 'login' - vwd2008 issue

data connection hourglass

silverlight

vwd closes when trying to go to design mode

visual web developer 2008 express closes automatically

dotnetnuke (dnn) vs. visual web developer - opinions?

asp.net runtime error: child nodes not allowed?

control extender menu not showing up.

machine.config problem after installing .net 3.5 and visual web developer 2008 express

how do i select multiple controls in vwd 2008

from vwd 2005 to vwd 2008

adjusting image size changes size of entire table

web conf error

  Privacy | Contact Us
All Times Are GMT