# SQL Server DBI insert silently fails

**URL:** <https://www.ruby-forum.com/t/sql-server-dbi-insert-silently-fails/100367>\
**Category:** Ruby\
**Created:** [July 28, 2006, 4:49pm UTC](https://www.ruby-forum.com/t/sql-server-dbi-insert-silently-fails/100367 "2006-07-28T16:49:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 28, 2006, 4:49pm UTC](https://www.ruby-forum.com/t/sql-server-dbi-insert-silently-fails/100367/1 "2006-07-28T16:49:22Z")

</div>

Hi all

I am having problems when trying to insert records using dbi-0.1.0 on  
Windows XP.  
I am using the ADO driver to connect to SQL Server, like so:

connectString = “DBI:ADO:provider=SQLOLEDB.1;Data Source=10.0.0.1;User  
id=xxxx; password=xxxx;Initial Catalog=DevDB”

I get rows == nil when I run this:

qry = "insert into G2.dbo.Device (IPadress, SerialNumber, VehicleID, " +  
“SerialNumberB, Tag1, Tag2, FwVersion, HwVersion) values  
(?, ?, ?, ?, ?, ?, ?, ?)”  
rows = @database.do(qry, device[:ip], device[:serial],  
device[:serial], device[:serial], 0, 0, 0, 0)  
print "rows done: "  
p rows

…and the record is not inserted. I get no other error response.

The strange thing is that select queries function perfectly, giving me  
valid data back.  
Any ideas?

Les

---

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 28, 2006, 4:59pm UTC](https://www.ruby-forum.com/t/sql-server-dbi-insert-silently-fails/100367/2 "2006-07-28T16:59:20Z")

</div>

Leslie V. wrote:

> The strange thing is that select queries function perfectly, giving me  
> valid data back.  
> Any ideas?
> 
> Les

Did you commit after inserting?

- Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [July 28, 2006, 9:32pm UTC](https://www.ruby-forum.com/t/sql-server-dbi-insert-silently-fails/100367/3 "2006-07-28T21:32:21Z")

</div>

On 7/28/06, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I get rows == nil when I run this:  
> > …and the record is not inserted. I get no other error response.  
> > Did you commit after inserting?  
> > You were right! I didn’t realise that some databases don’t commit  
> > automatically!  
> > I’m really grateful for your help.

Les
