Page 1 of 1

PB 4.41 - ODBC - databaseudate and temp tables on SQL Server

Posted: Mon Mar 01, 2010 7:47 pm
by Amnesty
Hi Fred,

I can't use databaseupdate with temporary tables on SQL Server.
At least until 4.31 it worked fine, and the following snippet shows what I am writing about:

Code: Select all

UseODBCDatabase()
If OpenDatabase(0, "dsn", "user", "pass")
  query.s = "select * into #temp_d1 from table"
  Databasequery(0, query) ; PB 4.41

;  DatabaseUpdate(0, query)
; with PB4.41 you can't use databaseUpdate anymore.

  query.s= "select * from #temp_d1"
  If DatabaseQuery(0, query)
    If NextDatabaseRow(0)
      Debug GetDatabaseString(0, 0)
      End 
    EndIf
  Else
    Debug DatabaseError()
  EndIf
EndIf
PS: This minor bug should not prevent me from telling you, that you are doing a great job!

Re: PB 4.41 - ODBC - databaseudate and temp tables on SQL Server

Posted: Tue Mar 02, 2010 9:52 am
by Fred
Update() is only valid when you really change the data. For a SELECT, you have to use Query().

Re: PB 4.41 - ODBC - databaseudate and temp tables on SQL Server

Posted: Sat Mar 06, 2010 12:50 pm
by Marlin
As far as I know "select ... into"
is usually used to copy [parts of] one table into another,
not to get any query results returned.

DatabaseUpdate() actually seems more appropiate and logical,
when you're making changes to the database
without trying to get back query results.

Does that statement actually work using DatabaseQuery()?

I don't currently have any database that supports "select ... into" at
my fingertipps.

I'm also curious about, what error was produced by DatabaseUpdate()
used with "select ... into", or why it wouldn't work.