Supose I have 2 tables
usersTable
- userid guid not null
- username nvarchar
- ...more fields
ArticleTable
- Articleid int not null
- Article ntext
- userid guid not null
- username nvarchar not null
- ...more fields
To add an article, a user has be loged in. So I do this to get their userId and username
' get the user currently logged in
Dim currentUser As MembershipUser = Membership.GetUser()
' Determine the currently logged on user's UserId value
Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid)
What I want is, when an article is inserted into the Article table by the logged in user, I want to add the username and userid to the article table. I am using Entity FrameWork 4.0 and programming in VB thanks yousaid