[Gambas-user] error trap an sql insert on a unique column

john hedge johnhedge at ...626...
Thu Dec 8 02:33:23 CET 2005


Thanks Daniel. Works a treat. I'd tried putting it in front of the sql
statement and infront of conn.Exec(sql) but I hadn't thought about you
suggestion.

Thanks

John

On 12/8/05, Daniel Campos <dcamposf at ...626...> wrote:
>
> I think:
>
> TRY res = conn.Exec(sql)
> IF ERROR THEN
>    Message.Error(Error.Text)
> END IF
>
> Should work
>
> Regards,
>
> D. Campos
>
> 2005/12/8, john hedge <johnhedge at ...626...>:
> >
> > Hi,
> >
> > I'm trying to setup a user input unique code.
> >
> > If the user enters a non unique code the error message "Query
> > failed........." Stop Continue etc. appears and the program exits.
> >
> > Is it possible to capture this process before this occurs, as in TRY
> > conn.Open and displays a relevant message indicating duplication?
> >
> > I've attached a screen shot which I hope helps show the situation.
> >
> > TIA
> >
> > John
> >
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20051208/f4f2747b/attachment.html>


More information about the User mailing list