Home > Archive > SQL Anywhere ultralite > December 2005 > ULCommand issue









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ULCommand issue
Sri

2005-12-28, 3:23 am

Hi,

I am new to sqlanywhere. I am creating an application using UltraLite
database and vs.net 2003 using UltraLite .Net. I have a basic question.
I have created a schema and a database. I deployed the application in
the Pocket PC 2003 emulator.
I used ULCommand class to insert 2 records into a table called
Customer.
After Insert when I retrieve the data from the Customer table, it
showed 2 records. I closed the application. Again I opened the
application it shows 0 records. When I read the documentation it says
insert, update, delete statements will be commited automatically. Am I
doing anything wrong?

The code is as follows,

ULCommand cmdInsert = Conn.CreateCommand();
cmdInsert.CommandText = "Insert into Customer(CustId,Name
)
values(?,?)";
cmdInsert.Transaction = trans;
cmdInsert.CommandType = CommandType.Text;
cmdInsert.Parameters.Add("CustId",1);
cmdInsert.Parameters.Add("Name","Sri");
cmdInsert.ExecuteNonQuery();
cmdInsert.Parameters[0].Value = 2;
cmdInsert.Parameters[1].Value = "SM";
cmdInsert.ExecuteNonQuery();

Please help...
Thanks & Regards

Sri

2005-12-28, 3:23 am

I am not using any Transaction. The code I have given in my previous
post contains
cmdInsert.Transaction = trans;
Please ignore that line.

ULCommand cmdInsert = Conn.CreateCommand();
cmdInsert.CommandText = "Insert into Customer(CustId,Name
)
values(?,?)";
cmdInsert.CommandType = CommandType.Text;
cmdInsert.Parameters.Add("CustId",1);
cmdInsert.Parameters.Add("Name","Sri");
cmdInsert.ExecuteNonQuery();
cmdInsert.Parameters[0].Value = 2;
cmdInsert.Parameters[1].Value = "SM";
cmdInsert.ExecuteNonQuery();

The records are not getting commited in the DB. Please help..

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com