Hello, Could someone help me to resolve the problem in my code. I'm currently developing a application and the edit function of the system has some flaws in terms of the syntax. This system is developed using VB.Net.

Private Sub cmdEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEdit.Click

        If Val(gridAdmin.Text) > 0 Then

            If MsgBox("Edit this Administrator Details?", vbExclamation + vbYesNo, "Edit Administrator Details") = vbYes Then
                SQL = "select * from admin_table where admin_ID = '" & gridAdmin.Text & "' "
                rsSQL.Open(SQL, cs, adOpenKeyset, adLockOptimistic, adCmdText)


                Call drawerOpen()
                Call cboOption()
                detailbox.Visible = True
                cmdUpdate.Visible = True
                cmdSave.Visible = False
                txtName.ReadOnly = True
                txtUsername.ReadOnly = True

                rs.Read()
                txtID.Text = rs("admin_ID")
                txtName.Text = rs("admin_Name")
                txtUsername.Text = rs("admin_Username")
                txtPassword.Text = rs("admin_Password")
                cboDesignation.Text = rs("admin_Designation")
            End If
        Else
            dummy = MsgBox("No Administrator Details found!", vbCritical, "Error")
        End If
        rs.Close()
        Conn.Close()
    End Sub

The errors are :-

Name 'cs' is not declared
Name 'adOpenKeyset' is not declared
Name 'adLockOptimistic' is not declared
Name 'adCmdText' is not declared

Could someone explain me how to declare these syntax. Thank you

This system is developed using VB.Net.

I highly doubt that. It looks like to be directly ported from VB6 which uses ADO.

I've no idea if it works but you may try to add a reference to ADO COM component. The better way would be to write it .NET way (which I won't do ;) )

Name 'cs' is not declared
Name 'adOpenKeyset' is not declared
Name 'adLockOptimistic' is not declared
Name 'adCmdText' is not declared
Could someone explain me how to declare these syntax

All except the first one are ADO constant values. Once you manage to import ADO they will be declared. Cs is ADO connection object which you have to declare yourself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.