sql - Insert Query with Foreign Key -


i have 3 tables in database , interlinked each other foreign keys. want insert query can enter data. can insert data each tables individually when using foreign key constraint getting errors.here table relationship , vba form through trying enter data vba form,relationships & data types

i using these 2 queries of second 1 throwing errors.

sql = "insert t1(id,fname,email)values('" & textbox1.text & "', '" & textbox2.text & "','" & textbox3.text & "')" sql = "insert t2(id,phonenumber,city) values (select(id t1 fname=" & textbox2.text & "),'" & textbox4.text & "','" & textbox5.text & "')" 

please note id main field in tables , search,update , delete field

the synatx used in second query invalid, have write insert .... select .... , remove values keyword this:

insert t2(id,phonenumber,city)  select id,'" & textbox4.text & "','" & textbox5.text & "' t1  fname=" & textbox2.text & " 

the values coming '" & textbox4.text & "','" & textbox5.text & "' selected string literals values coming id column, how can mix values selected query string literals , insert them in table.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -