how do i add information into database students (2 or 3 Related- tables)

hi ...good day,
im using vs2010 ultimate, i made a database for students & a simple one nothing fancy (winforms c#), just to track and record abcense and grades and final exam marks... tables are (students with student's ID and other demographics - courses with names and course ID - enrollment table with the keys of coursetbl and studentstbl and another key courseSemester and other fields like midterm exam grade and final grade and abcense times... )
first thing i added service based database (dont know if this is the right thing in the first place) because i want it to be embedded into the form whenever i publish it and to be easily managed or modified (please let me know if i should be using MSSQL server and connect it to my project with connection string and what have you..) please note that courses table i filled it with the data needed because it is known, course name and ID, but did not fill in anything for students table thus nothing in enrollment table...
my main question here:

now that i made these tables, i did not fill them with anything, now, i made the form and want to start adding in data into the enrollmentTbl , but i cannot add because i have to insert data into the students table first. so, do i have to add my student manually to their table then use the form to add data to the enrollment table? ??

or do i have hard code SQL insert statements/commands to insert (first into students table) then right below that command will make another command to insert into the enrollment table???
the latter works fine as a quick fix (unless it is the right thing to do) but does not feel right considering some DB rules or referential integrity rules or something i mean im not sure and i dont really know how to go about it.

on  a side note here, i tried to insert one record was in studentsTBL saved it then  i tried adding records into enrollementTbl (from the DB made within VS2010) with different student ID numbers, and saved fine, im guessing should it not say that i have to have a matching record in the studentsTBL ?

PK = stdid



i tried making a few Views and looks amazing but i need to know if im doing things right or maybe after adding 100 students i find that i messed the DB up and DB gets sick...

Many thanks in advance.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aaron JabamaniTechnical ArchitectCommented:
There are mater tables in a project, which should be pre populated before any uses the application. In your case it is course and course semester. Else, you need a GUI/screen to enter them or you can manually insert using sql commands.

Once above are added, you can go ahead and created students and assign them to courses from GUI.

If the foreign key constraint is throwing error mean, you have to check whether the constraint already exists.

You can create those in any order in the development, and while testing you can find the missing bits and fix as part of bug. At the end you proper working solution.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ahashashAuthor Commented:
Many thanks, it works now, you r right about entering manually, regards
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.