CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Location
    maharashtra,india
    Posts
    12

    Inserting data into database

    I doing a project on online exam. There are two tables question table and subject table(Access database). In the subject table there are two fields sub_id and sub_name. In the question table there is sub_id field. In the dataentry screen there is a combo box of subject name. I want that while data entry when the user selects the subject name from the combobox the corresponding subject id should be entered in the question table.

    I will be thankful if some one could suggest some code to solve the above query.




  2. #2
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: Inserting data into database

    Try this using a recordset

    INSERT INTO QUESTIONS (SUBJECT_ID)
    VALUES (
    SELECT SUBJECT_ID FROM SUBJECTS
    WHERE SUBJECT NAME = '<subject_name>');

    Hope this helps

    Andrew


+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width