Primary Key in Access for multi Client_ID - ms-access-2016

I am uploading legacy data to MS-Access via Excel. We have client Medications data and demographics etc. The common key is really the Client_ID. However in all data sets there will be multi rows per client, if there are more than one medication etc. it's a new row.
My concern is should my Primary Key be the Client_ID or should MS-Access auto create it, or should it be a combo of these?

Related

Mirroring a table by 3rd party software based on timestamp and $systemId?

The 3rd party web application is processing some information from the Microsoft Dynamics Nav database on Azure SQL. To access the table, the external table is created as a bridge from another database (also on Azure SQL).
Because of the performance reasons, the interesting part of the Nav table is to be mirrored to the 3rd party database -- using the custom data pump.
The problem is that the table ([...$Sales price]) has a composed key and not all of its parts is to be mirrored. The good news is that no record should be removed from the table (only INSERT and UPDATE operations). Another good news is that the new $systemId field was added as the unique key within the table. To combine it with the timestamp field...
If the records in the source table are not to be deleted, is it correct to mirror the data based on the timestamp field--to find newly inserted or updated records--and on the $systemId field--to recognize whether it is the UPDATE of the existing record, or INSERT of the new record?

Breeze server-generated keys of guids saving temporary client keys to database

I have set up a breeze app with entities set to autoGeneratedKeyType of Identity. My database uses char(32) guids for primary keys, which are generated as defaults on the PK columns, which are NOT set as identities.
Upon save, the record gets created in the database, but it saves with the temporary breeze generated keys of 'undefined-1', 'undefined-2' etc.
Can breeze handle this type of server-side key generation scheme? What are my options? I must stick with this key generation approach due to the design of the existing system. Generating guids on the client comes to mind...
Have you got any ideas?
If you are working with Guid's, I think best practice should be to generate them on the client. You can use the breeze.core.getUuid() method ( currently undocumented) to generate client side Guid's.
If you really want to generate them on the server, then you will need to use a Breeze KeyGenerator. There is more information on this topic here: Search for Key Generator within this page and within the API docs.

MVC4: External (OAuth) authentication & mapping to other tables/entities

I am building an MVC4 application and need to use external authentication (Facebook, etc). I have that working fine. I see the SimpleMembershipProvider creates 2 separate tables to handle this: "webpages_Membership" and "webpages_OAuthMembership". I need to map other tables (foreign keys) to User ID. The problem is both tables have a user ID which are unrelated to each other.. I could ignore the foreign keys in the database if necessary (don't like that though), but the bigger question is this: in code, how would I determine whether a user is authorized externally or locally so that I know where to get his other info from? Specifically, I have a user profile table where I will map other attributes to.. having 2 different types of user, how does one go about this?
Right, I have learned more about MVC4 and SimpleMembershipProvider and I see now that the User ID on both tables is actually a foreign key to a parent table called UserProfile. So, User IDs will still be unique.. it's just the mappings are a little different to what I was accustomed to with the standard ASP.NET membership provider. Email address and whatever other properties are required can be easily applied to the UserProfile table.

Converting unique string to a unique integer

I'm wanting to change our c# asp.net mvc application to work with windows authentication as well as forms authentication (as is currently implemented).
Currently we have a number of tables referencing a user id integer in the user table used by the forms authentication.
Is there an appropriate way of converting the unique string username returned by windows authentication to a unique integer that can be used as the id for the other tables?
An example might be using .GetHashCode() on the username, however I'm not sure if that will definitely create an appropriate integer (ie. unique, always the same integer returned given the same username, etc.)
GetHashCode() changes between framework versions, OS platform, etc., so you cannot rely on it for use as a DB PK.
If you are working with Windows authentication then maintaining the identify is useful for debugging, troubleshooting and possibly impersonation. Why not store it in a table with a Windows Username -> UserID mappings so that you can lookup a User ID given a user name?
Do not use GetHashCode()!
Instead, you should create a database table mapping Windows user accounts to integral user IDs (a Users table).
You can also store additional information about each user in this table.

what is the standard for creating a web REST API for adding new items

i have a order catalogue web site and i want to create a REST API so people can create their own apps and Add an Order or Update an existing order:
Lets say an order has:
OrderId
Product
Quantity
ShippingType
So i need some API to allow someone to send in a new order (orderid would be blank as that would be in the response).
How do you deal with passing in items like Product or Shipping type. These are tables in my db and are keyed off their own specific primary key id. Should the NewOrder API ask for a string name for these fields, should it ask for the id. If it asked for the ID, that would assume they would have to call the GiveMeProductList() method upfront (which gives you the name and id of all product as a dataset).
What is the standard for dealing with this?
Martin Fowler has a good post about the steps toward the glory of REST that you might find useful to come up with REST API.
The media type that I use for sending this information to the server can handle both scenarios, Id and Code/Name. If the user enters the product code manually then I send up the code, if the user asks to pick from a list then I provide the list and send back the Id.

Resources