FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour error with temporal table
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
error with temporal table
Posted: Tue Mar 05, 2019 12:46 AM
Guys:

I have create a temporary table in MSSQL with ADO from my program with succesful, but that table does not see it in the Microsoft SQL Server Management, someone know where is it, in tempdb?

The table has a single field and I insert a record, Up there all right, after I want to show its contents but I get this Message:

Error description: (DOS Error -2147352567) WINOLE/1007 No se encontró el elemento en la colección que corresponde al nombre o el ordinal solicitado. (0x800A0CC1): ADODB.Recordset


this is my code:

Code (fw): Select all Collapse
    oCon:=AbreConexBd()

    cSQL := "CREATE TABLE #ppru"
    cSQL += "("
    cSQL += "numero CHAR(6) NOT NULL "
    cSQL += ")"

   Try
      oCon:Execute( cSQL )
   Catch
      MsgInfo( "Table Create ppru Failed" )
      oDlg:End()
      Return(.f.)
   End try

oRs := TOleAuto():New( "ADODB.Recordset" )
oRs:CursorType     := 1        // opendkeyset
oRs:CursorLocation := 3        // local cache
oRs:LockType       := 3        // lockoportunistic

cSQL := "SELECT * from [#ppru]"

TRY
  oRS:Open(cSQL,oCon )
CATCH oErr
  MsgInfo( "Error in Opening #ppru table" )
  oCon:Close()
  RETURN(.F.)
END TRY

 oRs:CLose()

  cSQL := " insert into [#ppru] (numero) "
  cSQL += "values('123456') "

oRs := TOleAuto():New( "ADODB.Recordset" )
oRs:CursorType     := 1        // opendkeyset
oRs:CursorLocation := 3        // local cache
oRs:LockType       := 3        // lockoportunistic

oRS:Open(cSQL,oCon )
msgalert(oRs:Fields("numero"):Value)  //>>>>>>> AQUI ME BOTA ERROR <<<<<<<<<<<<<<
…
…
…
Function AbreConexBD()
  LOCAL cCString, oError, oCon1

  xPROVIDER := "SQLOLEDB"                  // oledb provider
  xSOURCE   := "PYSASERVER"                // sql server name
  xCATALOG  := "PysaBD"                    // sql server database
  xUSERID   := "sa"
  xPASSWORD := "Pysa123456"
  xConnect  := 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD

  TRY
    oCon1 := CreateObject( "ADODB.Connection" )
    oCon1:Open( xConnect )
  CATCH oError
     MsgStop( oError:Description )
  END
Return oCon1
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: error with temporal table
Posted: Tue Mar 05, 2019 03:19 PM

Temporary tables are seen only by the connection that created it and is deleted when that connection is closed. They are not seen by a different connection. Management Studio's connection is different from the connection you created in your application. So, Mangement studio cannot see the temporary table you created. That is the correct behaviour.

Regards



G. N. Rao.

Hyderabad, India
Posts: 400
Joined: Fri May 11, 2007 08:20 PM
Re: error with temporal table
Posted: Sat Mar 09, 2019 12:29 AM
nageswaragunupudi wrote:Temporary tables are seen only by the connection that created it and is deleted when that connection is closed. They are not seen by a different connection. Management Studio's connection is different from the connection you created in your application. So, Mangement studio cannot see the temporary table you created. That is the correct behaviour.


Thanks mr. rao always clear in the explanation
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql

Continue the discussion