Have a look at your IF statement:
If IsUniqueCode(Me.IdGuia, Me.NumeroGuia) Then
You are testing if it IS unique. You probably want to test if it is NOT unique.
You are right. Thanks
Before read this, I take a look to StrataFlix and found the same thing, I just adapt to my own BO and all works. Thanks for you help.
cmd.Parameters.AddWithValue(
Kindest regards Everything is possible, just keep trying...
Just for you to think about, have a look at the Localization & Message Editor. It might be a good idea to start creating your messages with it, and then use it in your application using the message keys, instead of entering an string directly. This way not only you get a centralized editor for all your messages, but are only 1 step away from having a multi-language application.
Have a great weekend.
hasDupe = MyBo.CurrentDataTable.Select("MyPk <> 1 AND MyLastName = 'Taylor'").Length > 0
You can use this in conjunction with the server side query. Do one and then the other to make sure that there are no dupes on either side of the committed records.
Also, Ivan's suggestions about the localization records are good...it is a much better way to keep up with your messages, etc. Especially if you have the need to localize an app!
Thanks for you comment. The other solution is in the BO, this validation you mention, Where should it go? I think that in the Validating event of the control, but I'm not sure.
About localization, I'm working in two apps right now. One has localization for every part of it because is English/Spanish, but the other no, that's why I'm using only direct text for messages.