SQL Server DBI insert silently fails

L

Leslie Viljoen

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
 
D

Daniel Berger

Leslie said:
Hi all
=20
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:
=20
connectString =3D "DBI:ADO:provider=3DSQLOLEDB.1;Data = Source=3D10.0.0.1;User
id=3Dxxxx; password=3Dxxxx;Initial Catalog=3DDevDB"
=20
I get rows =3D=3D nil when I run this:
=20
qry =3D "insert into G2.dbo.Device (IPadress, SerialNumber, VehicleID, = " +
"SerialNumberB, Tag1, Tag2, FwVersion, HwVersion) values
(?, ?, ?, ?, ?, ?, ?, ?)"
rows =3D @database.do(qry, device[:ip], device[:serial],
device[:serial], device[:serial], 0, 0, 0, 0)
print "rows done: "
p rows
=20
=20
..and the record is not inserted. I get no other error response.
=20
=20
The strange thing is that select queries function perfectly, giving me
valid data back.
Any ideas?
=20
=20
Les
=20

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=20
prohibited and may be unlawful. If you have received this communication =

in error, please immediately notify the sender by reply e-mail and =
destroy=20
all copies of the communication and any attachments.
 
L

Leslie Viljoen

Leslie said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top