如何在我的代码中放置陷阱而不是保存现有的活动名称 [英] how to put trappings in my code not to save an existing activityname

查看:91
本文介绍了如何在我的代码中放置陷阱而不是保存现有的活动名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

If ValidateData() = False Then
          Exit Sub
      End If
      If UpdateData() Then
          If MyMode = "Add" Then

              MsgBox("New Activity Added Successfully !", CType(vbInformation + vbOKOnly, MsgBoxStyle), "Update Status")
              PopulateList()
              ClearMyCtls()
              txtStudentID.Text = GetNextPrimaryKey(con, "Activity", "Activity_ID").ToString("######000")
              txtStudentID.Focus()

              Exit Sub
          End If

推荐答案

如评论中所述,我建议您在验证方法期间调用您的数据库,以确定该记录是否存在。然后从那里处理。
As mentioned in comments, I suggest you call into your db during your Validate method to determine if the record exists or not. Then handle from there.


这篇关于如何在我的代码中放置陷阱而不是保存现有的活动名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆