error with temporal table

Post Reply
artu01
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

error with temporal table

Post by artu01 »

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: Select all | Expand



    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
User avatar
nageswaragunupudi
Posts: 10729
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 10 times
Contact:

Re: error with temporal table

Post by nageswaragunupudi »

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
artu01
Posts: 400
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Re: error with temporal table

Post by artu01 »

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
Post Reply