Results 1 to 3 of 3

Thread: datagrid error: no such interface supported

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2001
    Posts
    2

    datagrid error: no such interface supported

    Hi,
    I came across an error while I was trying to bind a recorset to a datagrid.
    You can read the code of my subroutine above.
    I'm able to open the recordset but when I try to set the datasource of my Datagrid (NameGrid) an error occurs.
    I can see this error only in MyConnection.Errors.
    The error description is "no such interface supported"
    Native Error:-2147467262
    Number:-2147467262
    Source:Provider
    SQLState:""

    The strange thing is that if I set the datasource immediatly before opening the recordset and then I execute a requery (see Solution 2) no error occurs.

    Can anyone give me some advice ?
    Thank you
    Private Sub Form_Load()

    Dim Cmd As New ADODB.Command
    Dim ret_code As Integer
    Dim par_recordset As New ADODB.Recordset

    Dim SQLQuery As String
    With par_recordset
    .ActiveConnection = MyConnection
    .LockType = adLockOptimistic
    .CursorType = adOpenStatic
    End With

    SQLQuery = "SELECT * FROM MyTable"
    Set Cmd.ActiveConnection = MyConnection
    Cmd.CommandText = SQLQuery
    Cmd.CommandType = adCmdText


    Solution 1
    par_recordset.Open Cmd
    Set NameGrid.DataSource = par_recordset

    Solution 2
    Set NameGrid.DataSource = par_recordset
    par_recordset.Open Cmd
    par_recordset.Requery

    End Sub
    Last edited by calzolani; Nov 8th, 2001 at 11:52 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width