gulya2005
7th December 2005, 13:49
Session breaks up because one table doesn't exist in company,but in other company this table exist. Is it possible to intercept this message and continue without the program breaking up?

Error appears when fetching with dynamic sql,but no error when sql.parse.

I saw this question on this forum, but i did not understand how to use predefined variable error.

thanks.

george7a
7th December 2005, 14:18
You can check the company you are in and if it is the right one then execute the SQL.

You can use get.compnr() to know in what company you are. also there are other functions that change the current company.

I hope it helps,

- George

gulya2005
7th December 2005, 14:38
I need to update number of supplier in two company in many tables.I do not
know is there this table in this company and I do not want to create array.

mark_h
7th December 2005, 14:49
Not sure if this will work for you, but I used this in one program just to check if tables existed. Probably you just need the error.bypass variable. I was doing checking to see if certain table fields were being used.


| Errors should now return false - so unallocated tables will be skipped.
error.bypass = 1
found = false
sql = "select " & table.field & " from " & table.name
sql = sql & " where " & table.field & " <> """" as set with 1 rows"
sql_id = sql.parse(sql)
sql.exec(sql_id)

Hitesh Shah
7th December 2005, 15:00
Error.bypass will definitely work . Return value of sql.exec will be 506 when table does not exist or value e will become 506 .

U can also create the table if u wish so using db.create.table .

gulya2005
7th December 2005, 15:07
It is help me.