Outputting data with an Access Database but users stored in an SQL database
I'm creating an ecommerce site using asp.net and a Access Datasource, I have used the pre-defined logging in and registering controls provided by Visual Studio 2010 which stores the user data in a SQL server.
For my site the content of the shopping cart is uploaded to a table in the access database, I need to however save the contents of the cart to a specific user ID. For example if User number 1 orders book id's 4,7,2 this needs to be saved, but if user number 2 comes along and orders 4,开发者_高级运维1,7 this needs to be saved for them as well.
So a user can have many carts, this is sorted in access but with the user ID being saved to a different database is there anyway I can link the two databases so I can say
"Save bookid's 1,2,3 in tblcart where userID is the same as the logged in user"
Hope you understand what I mean.
Thanks
From the sounds of it. You don't need to do anything special. So long as there is a user_id field stored in tblCart you should be fine.
You won't have any "official" relationships defined, but that doesn't really matter... if a logged in user wants to see all of their "carts" you would just do: SELECT * FROM tblCarts WHERE user_id = LoggedInUsersID.
精彩评论