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 view RUN
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