know this is probably something simple but my button click handle is inserting 2 records in my SQL table when it should be inserting 1 record. Can anyone determine what this could be.
here is the code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
dreader.Close()
strSql = "select statusdesc,contact.statusid from Contact inner join contactstatus on contact.statusid = contactstatus.statusid where contact.contactid = '" & contid & "'"
conn = New SqlClient.SqlConnection(strconn)
sqlcmd2 = New SqlCommand(strSql, conn)
conn.Open()
dreader2 = sqlcmd2.ExecuteReader()
dreader2.Read()
Me.Label1.Text = dreader2.Item(1).ToString
'conn.Close()
strSql = "insert into ContactHistory(contactid,statusid,userid,note) values('" & Me.lblInquiry.Text & "','" & Me.Label1.Text & "','" & Session("userid") & "','" & Me.txtNote.Text & "')"
conn = New SqlClient.SqlConnection(strconn)
conn.Open()
Dim Com As New System.Data.SqlClient.SqlCommand(strSql, conn)
Com.CommandText = strSql
Com.ExecuteNonQuery()
conn.Close()
'SetFocus(Me.TextBox3)
End Sub