# Database Error Messages ???

**URL:** <https://forum.xojo.com/t/database-error-messages/18795>\
**Category:** Databases\
**Created:** [August 22, 2014, 3:50pm UTC](https://forum.xojo.com/t/database-error-messages/18795 "2014-08-22T15:50:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [August 22, 2014, 3:50pm UTC](https://forum.xojo.com/t/database-error-messages/18795/1 "2014-08-22T15:50:30Z")

</div>

Hi,  
Does anyone know the difference between these 2 error messages:

Error 0 - Unable to Prepare Statement:  
Error 1 - Unable to Prepare Statement:

Would be nice if a member of technical staff could point out the difference, or is there a list somewhere of Xojo® error messages?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 23, 2014, 8:50am UTC](https://forum.xojo.com/t/database-error-messages/18795/2 "2014-08-23T08:50:45Z")

</div>

Maybe just a syntax error?

It would of course help to know what database you have.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 23, 2014, 8:55am UTC](https://forum.xojo.com/t/database-error-messages/18795/3 "2014-08-23T08:55:22Z")

</div>

if you look at this test code, you will see that Prepare command gives correct error about missing table while prepare than give no good error.

[code] dim db as new SQLiteDatabase

call db.Connect

db.SQLExecute “select \* from test where r = 1”

if db.Error then  
MsgBox "SQLExecute: "+db.ErrorMessage  
end if

dim p as PreparedSQLStatement = db.Prepare(“select \* from test where r = ?”)

if db.Error then  
MsgBox "Prepare: "+db.ErrorMessage  
end if

p.Bind(0, 1)  
p.BindType(0, SQLitePreparedStatement.SQLITE\_INTEGER)

p.SQLExecute

if db.Error then  
MsgBox "Prepared SQLExecute: "+db.ErrorMessage  
end if

[/code]

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [August 23, 2014, 10:45am UTC](https://forum.xojo.com/t/database-error-messages/18795/4 "2014-08-23T10:45:52Z")

</div>

I’m using SQLite, and was hoping there was some kind of error message list somewhere, which detailed exactly what each error message meant.

Telling the user Error 0 - Unable to Prepare Statement: seems a bit pointless really, as it does not actually indicate what the error is, and leaves you guessing.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 23, 2014, 10:54am UTC](https://forum.xojo.com/t/database-error-messages/18795/5 "2014-08-23T10:54:40Z")

</div>

you have to check for the error details after the prepare, not after the SQLSelect.

---

<div class="post-metadata">

**Author:** ![Richard\_Summers](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_summers/32/477_2.png) [@Richard\_Summers](https://forum.xojo.com/u/Richard_Summers)\
**Post date:** [August 23, 2014, 11:24am UTC](https://forum.xojo.com/t/database-error-messages/18795/6 "2014-08-23T11:24:41Z")

</div>

So basically, 2 error checks - 1 after the prepare, and another after p.SQLExecute (or p.SQLSelect).  
I usually only do one - after the p.SQLExecute.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [August 23, 2014, 12:18pm UTC](https://forum.xojo.com/t/database-error-messages/18795/7 "2014-08-23T12:18:28Z")

</div>

yes

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:23pm UTC](https://forum.xojo.com/t/database-error-messages/18795/8 "2020-10-29T17:23:16Z")

</div>


