My requirement is to delete a selected row in the datagrid from SQL server. If no row is selected then nothing should happen.
Below is my code
Private Sub BT_Remove_Click() On Error GoTo ErDsc: Dim MyConn As ADODB.Connection Dim MyRecSet1 As New ADODB.Recordset Set MyConn = New ADODB.Connection MyConn.ConnectionString = "Provider=SQLOLEDB;Data Source=TGSSRV-08;Initial Catalog=RMG;User Id=RMG;Password=Thinksoft;Trusted_Connection=no" MyConn.Open If AddProfile.DataGrid2.SelBookmarks.Count = 0 Then MsgBox ("Please select the profile that you want to delete"), vbOKOnly, "Alert" Exit Sub End If
But when the code is executed I am gettign error "RowSet not available"
Dont know the reason. Kindly help me.