Click here to Skip to main content
15,903,856 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
Richard MacCutchan25-Nov-18 3:49
mveRichard MacCutchan25-Nov-18 3:49 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
desanti25-Nov-18 3:53
desanti25-Nov-18 3:53 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
Richard MacCutchan25-Nov-18 4:03
mveRichard MacCutchan25-Nov-18 4:03 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
Eddy Vluggen25-Nov-18 3:55
professionalEddy Vluggen25-Nov-18 3:55 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
desanti25-Nov-18 4:39
desanti25-Nov-18 4:39 
GeneralRe: CtypeDynamic : How can i detect if an expression can be converted to a specific Date format Pin
Eddy Vluggen25-Nov-18 5:54
professionalEddy Vluggen25-Nov-18 5:54 
QuestionMdiParent property reverts to Nothing after assigned to other MDIParent Pin
FedericoMui23-Nov-18 22:25
FedericoMui23-Nov-18 22:25 
QuestionProblems verifying if an object exist on entity framework Pin
desanti19-Nov-18 6:09
desanti19-Nov-18 6:09 
Hello !
I'm using vb.net with EF 6 and sql server 2008R2.

I have one table on database
Myobject ( id , code , name)

I want to add new records but verifying if an object with the same code exist. These records that have the same code are not added.

Dim mynewobject as Myobject
For I=1 to 100
newcode= InputBox("Input code", "Value")
newname= InputBox("Input Name", "Value")
if IsNothing(context.Myobjects.Where(Function(t1) t1.code=newcode).Firstordefault) then
      mynewobject=New Myobject
      mynewobject.code=newcode
      mynewobject.name=newname
      context.Myobjects.Add(mynewobject)
end if
Next
context.savechanges


Now let's suppose that i want to add these records :
Id     Code    Name
1       cd1    Name1
2       cd2    Name2
3       cd1    Name3


The third record should not be added because has the same code with the first record that has been added before.

But when i execute my code , the third record is added too.


What can i do ?

Thank you !
AnswerRe: Problems verifying if an object exist on entity framework Pin
Richard Deeming19-Nov-18 6:15
mveRichard Deeming19-Nov-18 6:15 
AnswerRe: Problems verifying if an object exist on entity framework Pin
Eddy Vluggen19-Nov-18 6:21
professionalEddy Vluggen19-Nov-18 6:21 
GeneralRe: Problems verifying if an object exist on entity framework Pin
Mycroft Holmes19-Nov-18 10:59
professionalMycroft Holmes19-Nov-18 10:59 
GeneralRe: Problems verifying if an object exist on entity framework Pin
Eddy Vluggen19-Nov-18 13:26
professionalEddy Vluggen19-Nov-18 13:26 
GeneralRe: Problems verifying if an object exist on entity framework Pin
Mycroft Holmes20-Nov-18 11:05
professionalMycroft Holmes20-Nov-18 11:05 
GeneralRe: Problems verifying if an object exist on entity framework Pin
Eddy Vluggen20-Nov-18 11:09
professionalEddy Vluggen20-Nov-18 11:09 
QuestionEntity framework 6 : When to call Savechanges ? Pin
desanti17-Nov-18 1:10
desanti17-Nov-18 1:10 
AnswerRe: Entity framework 6 : When to call Savechanges ? Pin
Eddy Vluggen17-Nov-18 1:20
professionalEddy Vluggen17-Nov-18 1:20 
GeneralRe: Entity framework 6 : When to call Savechanges ? Pin
desanti17-Nov-18 7:33
desanti17-Nov-18 7:33 
GeneralRe: Entity framework 6 : When to call Savechanges ? Pin
Eddy Vluggen17-Nov-18 12:08
professionalEddy Vluggen17-Nov-18 12:08 
AnswerRe: Entity framework 6 : When to call Savechanges ? Pin
Dave Kreskowiak17-Nov-18 5:02
mveDave Kreskowiak17-Nov-18 5:02 
GeneralRe: Entity framework 6 : When to call Savechanges ? Pin
desanti17-Nov-18 7:41
desanti17-Nov-18 7:41 
AnswerRe: Entity framework 6 : When to call Savechanges ? Pin
Richard Deeming19-Nov-18 2:43
mveRichard Deeming19-Nov-18 2:43 
QuestionVb.net and Crystal Report Pin
Bj Molo15-Nov-18 1:38
Bj Molo15-Nov-18 1:38 
AnswerRe: Vb.net and Crystal Report Pin
Eddy Vluggen15-Nov-18 1:45
professionalEddy Vluggen15-Nov-18 1:45 
GeneralRe: Vb.net and Crystal Report Pin
Bj Molo15-Nov-18 1:52
Bj Molo15-Nov-18 1:52 
GeneralRe: Vb.net and Crystal Report Pin
Eddy Vluggen15-Nov-18 2:05
professionalEddy Vluggen15-Nov-18 2:05 

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.