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

Just starting out? Need help? Post your questions and find answers here.
Amnesty
User
User
Posts: 54
Joined: Wed Jul 04, 2007 4:34 pm
Location: Germany

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

Post 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!
Fred
Administrator
Administrator
Posts: 18254
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

Update() is only valid when you really change the data. For a SELECT, you have to use Query().
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

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

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