CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Posts
    14

    Cannot Open RecordSet

    Hi,
    why do I get this error, What can I do ?
    Thanks

    cmd.CommandType = adCmdText
    Set cmd.ActiveConnection = cnnMyConnection
    cmd.CommandText = "Create Table MyTable "
    Set rsTable = cmd.Execute


    rsTable.AddNew
    ----ERROR: Object is closed ?????

    rsTable.Fields("Name") = "Kathy"
    rsTable.Fields("City") = "Montreal"





  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Cannot Open RecordSet

    IMHO this should rather look like this:

    cmd.CommandType = adCmdText
    set cmd.ActiveConnection = cnnMyConnection
    cmd.CommandText = "Create Table MyTable "
    ' create the table
    cmd.Execute
    ' now open a recordset
    cmd.commandtext = "select * from mytable"
    set rsTable = cmd.Execute
    ...





  3. #3
    Join Date
    Aug 1999
    Posts
    14

    Re: Cannot Open RecordSet


    At the second .Execute :
    I've got error "Could not find MyTable"

    Looks like the first Excecute does not work




  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Cannot Open RecordSet

    well, I thought that your statement was meant as an example.
    Of course "Create table mytable" is not valid SQL. You need to specify the fields of your table as in:
    create table mytable(firstfield char(20))

    Also, check all errors that you get when executing a statement.


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

Featured