[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

SQL Server DBI insert silently fails

Leslie Viljoen

7/28/2006 2:46:00 PM

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

2 Answers

Berger, Daniel

7/28/2006 2:59:00 PM

0

Leslie Viljoen wrote:
> 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
>

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.

Leslie Viljoen

7/28/2006 7:30:00 PM

0

On 7/28/06, Daniel Berger <Daniel.Berger@qwest.com> wrote:
> Leslie Viljoen wrote:
> > 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
> >
>
> 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