Click here to Skip to main content
15,887,346 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Compare tables and show the difference Pin
byka8-Oct-14 3:08
byka8-Oct-14 3:08 
GeneralHighchart server side settings and update Pin
KokDavy6-Oct-14 13:09
KokDavy6-Oct-14 13:09 
GeneralRe: Highchart server side settings and update Pin
Dave Kreskowiak6-Oct-14 17:43
mveDave Kreskowiak6-Oct-14 17:43 
QuestionThe state value of an object ? Pin
dilkonika4-Oct-14 16:52
dilkonika4-Oct-14 16:52 
AnswerRe: The state value of an object ? Pin
Dave Kreskowiak4-Oct-14 18:53
mveDave Kreskowiak4-Oct-14 18:53 
GeneralRe: The state value of an object ? Pin
dilkonika5-Oct-14 3:39
dilkonika5-Oct-14 3:39 
GeneralRe: The state value of an object ? Pin
Dave Kreskowiak5-Oct-14 5:00
mveDave Kreskowiak5-Oct-14 5:00 
QuestionAdding records and save changes simultaneosly for 2 tables Pin
dilkonika3-Oct-14 11:04
dilkonika3-Oct-14 11:04 
Hello !

I have a project in vb.net 2013 , Entity Framework 6 and SQL server 2008R2.

I have this situation :

In database I have 2 tables :

Table 1 : ID (aUTONUMBER, primary kEY) , Name , vl1

Table 2 : ID (AUTONUMBER , primary KEY) , name , value , Table1_id (Foreign key related with ID field in Table1).

In my Form :

I HAVE 2 BINDINGSOURCES : Table1BindingSource and Table2Bindingsource.

I have 3 buttons : New1 - that add new record in Table1BindingSource , New2 - that add a new record in Table2BindingSource , SAVE - tHAT SAVE ALL to database.

I HAVE PROBLEMS IN THIS CASE :

I ADD A NEW RECORD IN Table1BindingSource . After I Add new record to Table2Bindingsource ( but since the id field in Table1Bindingsource is not set yet, I set the Table1_id=0 for this new record ).

After I press the Save button that has this code :

--------------------------------------------------

Table2bindingsource.SuspendBinding()

context.savechanges()

For each itm in table2bindingsource

itm.Table1_id=Table1bindingsource.current.id

Next

Table2bindingsource.ResumeBinding()

context.savechanges()

-----------------------------------------------------

But after this , in database I have 1 record in Table1 , but on Table2 I have no records.

What can I do , because I need that users can add records to both bindingsources and after to press the save button ?

Thank you !
AnswerRe: Adding records and save changes simultaneosly for 2 tables Pin
Eddy Vluggen3-Oct-14 12:49
professionalEddy Vluggen3-Oct-14 12:49 
AnswerRe: Adding records and save changes simultaneosly for 2 tables Pin
Eddy Vluggen6-Oct-14 9:12
professionalEddy Vluggen6-Oct-14 9:12 
Questioni want add/edit/delete access table in database on vb2010 Pin
Member 105203861-Oct-14 1:01
Member 105203861-Oct-14 1:01 
AnswerRe: i want add/edit/delete access table in database on vb2010 Pin
Richard MacCutchan1-Oct-14 4:37
mveRichard MacCutchan1-Oct-14 4:37 
SuggestionRe: i want add/edit/delete access table in database on vb2010 Pin
ZurdoDev2-Oct-14 5:00
professionalZurdoDev2-Oct-14 5:00 
QuestionMove a file according to a name inside the file itself. Pin
val566230-Sep-14 19:08
val566230-Sep-14 19:08 
AnswerRe: Move a file according to a name inside the file itself. Pin
Eddy Vluggen2-Oct-14 4:44
professionalEddy Vluggen2-Oct-14 4:44 
QuestionProblem with entity objects after refreshing model from database Pin
dilkonika30-Sep-14 11:34
dilkonika30-Sep-14 11:34 
AnswerRe: Problem with entity objects after refreshing model from database Pin
Eddy Vluggen2-Oct-14 4:49
professionalEddy Vluggen2-Oct-14 4:49 
QuestionAdd formatting to an excel cell in a loop Pin
Member 1111259730-Sep-14 6:11
Member 1111259730-Sep-14 6:11 
Questioncreate an xml request Pin
jim haras29-Sep-14 1:56
jim haras29-Sep-14 1:56 
AnswerRe: create an xml request Pin
jim haras30-Sep-14 2:47
jim haras30-Sep-14 2:47 
GeneralRe: create an xml request Pin
Eddy Vluggen30-Sep-14 3:04
professionalEddy Vluggen30-Sep-14 3:04 
AnswerRe: create an xml request Pin
Richard Deeming30-Sep-14 3:28
mveRichard Deeming30-Sep-14 3:28 
GeneralRe: create an xml request Pin
jim haras30-Sep-14 3:49
jim haras30-Sep-14 3:49 
GeneralRe: create an xml request Pin
Richard Deeming30-Sep-14 7:42
mveRichard Deeming30-Sep-14 7:42 
QuestionCalculating total value of different items Pin
Kushal Kumar27-Sep-14 18:11
Kushal Kumar27-Sep-14 18:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.