On Tuesday 11 August 2009 11:33:30 David Budny wrote:
> I'm trying to use func_odbc to write to a MS SQL db.
>
> Here's my func_odbc conf:
>
> [OPTIN]
> dsn=MSSQL-Optin
> write=INSERT into OptIn (orgID) values (${VAL1})
>
> Dial Plan
>
> exten => +18665551212,n,Set(ODBC_OPTIN()=dave)
>
> When I do an odbc show, it shows that I am connected to the db. If I use
> isql, I can write to the db, however, when I use func_odbc, a record will
> not write.  I'm using asterisk 1.4.9. Any idea what might be wrong?

I suspect the problem is that you're missing the necessary quotes for
the string value of "dave".  Try, instead:

write=INSERT INTO OptIn (orgID) values ('${SQL_ESC(${VAL1})}')

MS SQL Server only permits you to leave the quotes off when you're
inserting a value into a numeric field.

-- 
Tilghman & Teryl
with Peter, Cottontail, Midnight, Thumper, & Johnny (bunnies)
and Harry, BB, & George (dogs)

_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to