troubleshooting Question

Duplicate Validation in code(vb)

Avatar of Ed
EdFlag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingASP.NETVisual Basic.NET
2 Comments1 Solution54 ViewsLast Modified:
How can I check for a record that exists before insert in code behind.


In the below I want to check that the @QUALSCHEMEID exist or not

 Public Sub InsertGCH()

            'If Session("ModeType") = "Insert" Then

            Dim strConnString As String = ConfigurationManager.ConnectionStrings("IrisConnectionString").ConnectionString

            Dim con As New SqlConnection(strConnString)

            Dim cmd As New SqlCommand()

            cmd.CommandType = CommandType.StoredProcedure

            cmd.CommandText = "Insert_REVIEWS_GCH"

            'cmd.Parameters.Add("@TRAINEEID", SqlDbType.NVarChar).Value = Request("TRAINEEID")

            'cmd.Parameters.Add("@POT", SqlDbType.Int).Value = Request("POT")

            cmd.Parameters.Add("@QUALSCHEMEID", SqlDbType.Int).Value = ddlQUALSCHEMEID.SelectedValue.Trim()

            cmd.Parameters.Add("@ReviewID", SqlDbType.Int).Value = Session("REVIEWS")

            cmd.Parameters.Add("@GCH", SqlDbType.NVarChar).Value = txtGCH.Text.Trim()

            cmd.Connection = con





        End Sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros