dbTalk Databases Forums  

-191 SQLE_CANNOT_MODIFY

sybase.public.sqlanywhere.ultralite sybase.public.sqlanywhere.ultralite


Discuss -191 SQLE_CANNOT_MODIFY in the sybase.public.sqlanywhere.ultralite forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeff
 
Posts: n/a

Default -191 SQLE_CANNOT_MODIFY - 11-06-2007 , 08:58 AM






9.0.2 Build 3575

When assigning the date value to the "INJ_DATE" field in an
Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue = "11/6/2007"

The INJ_DATE field is part of an index in the table schema.

Why am I getting this error?

Thanks,
Jeff.

Reply With Quote
  #2  
Old   
Michael Thode
 
Posts: n/a

Default Re: -191 SQLE_CANNOT_MODIFY - 11-06-2007 , 09:32 AM






You can not update a column in the index that the table object is using. By
default table objects use the primary key, but they can be opened using any
index on the table.

Your options to get around this are...
- Open a table object on a different index.
- Use a sql update statement.

Mike

<Jeff> wrote

Quote:
9.0.2 Build 3575

When assigning the date value to the "INJ_DATE" field in an
Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue = "11/6/2007"

The INJ_DATE field is part of an index in the table schema.

Why am I getting this error?

Thanks,
Jeff.



Reply With Quote
  #3  
Old   
Jeff
 
Posts: n/a

Default Re: -191 SQLE_CANNOT_MODIFY - 11-06-2007 , 09:43 AM



Thanks Mike.. I tried to use the sql update and I now
receive
-187
SQLE_CURSORDROP_NOT_ALLOWED

It's almost like that field is locked since I opened a
connection to the table when I start the application.

ULINJURYtable.Open "idx_inj_date"


Quote:
You can not update a column in the index that the table
object is using. By default table objects use the
primary key, but they can be opened using any index on
the table.

Your options to get around this are...
- Open a table object on a different index.
- Use a sql update statement.

Mike

Jeff> wrote in message
news:47308132.314e.1681692777 (AT) sybase (DOT) com... 9.0.2 Build
3575
When assigning the date value to the "INJ_DATE" field in
an Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue =
"11/6/2007"
The INJ_DATE field is part of an index in the table
schema.
Why am I getting this error?

Thanks,
Jeff.



Reply With Quote
  #4  
Old   
Michael Thode
 
Posts: n/a

Default Re: -191 SQLE_CANNOT_MODIFY - 11-06-2007 , 02:16 PM



Are you doing a cursor update using a result set? If so I'd guess that you
were missing an UpdateBegin() call.

Alternatively you can update with out a cursor using the following SQL

update ULINJURY set INJ_DATE = "11/6/2007" where id = ?

If that doesn't help, please post the lines of code that you used to do the
update.

Mike

<Jeff> wrote

Quote:
Thanks Mike.. I tried to use the sql update and I now
receive
-187
SQLE_CURSORDROP_NOT_ALLOWED

It's almost like that field is locked since I opened a
connection to the table when I start the application.

ULINJURYtable.Open "idx_inj_date"


You can not update a column in the index that the table
object is using. By default table objects use the
primary key, but they can be opened using any index on
the table.

Your options to get around this are...
- Open a table object on a different index.
- Use a sql update statement.

Mike

Jeff> wrote in message
news:47308132.314e.1681692777 (AT) sybase (DOT) com... 9.0.2 Build
3575
When assigning the date value to the "INJ_DATE" field in
an Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue =
"11/6/2007"
The INJ_DATE field is part of an index in the table
schema.
Why am I getting this error?

Thanks,
Jeff.





Reply With Quote
  #5  
Old   
Jeff
 
Posts: n/a

Default Re: -191 SQLE_CANNOT_MODIFY - 11-07-2007 , 01:57 PM



This app was written prior to UL9 - this is why I am not
using dynamic SQL. The TREATMENT table updates perfectly
even though its defined the exact same way as the INJURY
table. When I do the INJURY table update, I receive.. -191
SQLE_CANNOT_MODIFY. If I code in some dynamic SQL and try
the same thing.. I get the -187 SQL_CURSOROP_NOT_ALLOWED.


Original Code
ULTREATMENTtable.MoveBeforeFirst
ULTREATMENTtable.FindBegin
ULTREATMENTtable.Column("TREAT_DATE").StringValue =
CurrentTreatmentDate
ULTREATMENTtable.Column("TREATMENT_ID").DoubleValu e =
CurrentTreatmentID
ULTREATMENTtable.FindFirst
ULTREATMENTtable.UpdateBegin
ULTREATMENTtable.Column("TREAT_DATE").StringValue =
lblTreatDate.Caption
ULTREATMENTtable.Update


ULINJURYtable.MoveBeforeFirst
ULINJURYtable.FindBegin
ULINJURYtable.Column("INJ_DATE").StringValue =
CurrentInjuryDate
ULINJURYtable.Column("INJURY_ID").DoubleValue =
CurrentInjuryID
ULINJURYtable.FindFirst
ULINJURYtable.UpdateBegin
ULINJURYtable.Column("INJ_DATE").StringValue =
lblInjDate.Caption
ULINJURYtable.Update

Both tables are opened with the date and id index. The
indexes and tables are defined the same way in the schema.
ULTREATMENTtable.Open "idx_treat_date"
ULINJURYtable.Open "idx_inj_date"


Replaced Dynamic SQL CODE

Set UpdatePS = Connection.PrepareStatement( _
"UPDATE injury set inj_date=? where injury_id = ?")

UpdatePS.SetStringParameter 1, lblInjDate.Caption
UpdatePS.SetDoubleParameter 2, CurrentInjuryID
UpdatePS.ExecuteStatement
ULINJURYtable.Update



Quote:
Are you doing a cursor update using a result set? If so
I'd guess that you were missing an UpdateBegin() call.

Alternatively you can update with out a cursor using the
following SQL

update ULINJURY set INJ_DATE = "11/6/2007" where id = ?

If that doesn't help, please post the lines of code that
you used to do the update.

Mike

Jeff> wrote in message
news:47308bac.326b.1681692777 (AT) sybase (DOT) com... Thanks
Mike.. I tried to use the sql update and I now receive
-187
SQLE_CURSORDROP_NOT_ALLOWED

It's almost like that field is locked since I opened a
connection to the table when I start the application.

ULINJURYtable.Open "idx_inj_date"


You can not update a column in the index that the table
object is using. By default table objects use the
primary key, but they can be opened using any index on
the table.

Your options to get around this are...
- Open a table object on a different index.
- Use a sql update statement.

Mike

Jeff> wrote in message
news:47308132.314e.1681692777 (AT) sybase (DOT) com... 9.0.2
Build >> 3575
When assigning the date value to the "INJ_DATE" field
in >> > an Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue =
"11/6/2007"
The INJ_DATE field is part of an index in the table
schema.
Why am I getting this error?

Thanks,
Jeff.





Reply With Quote
  #6  
Old   
Michael Thode
 
Posts: n/a

Default Re: -191 SQLE_CANNOT_MODIFY - 11-08-2007 , 01:21 PM



You can't call ULINJURYtable.Update without calling
ULINJURYtable.UpdateBegin first. That is whats raising the -187.
However, there is no need to call ULINJURYtable.Update when you use dynamic
sql. Your row has already been updated with UpdatePS.ExecuteStatement.

Mike

<Jeff> wrote

Quote:
This app was written prior to UL9 - this is why I am not
using dynamic SQL. The TREATMENT table updates perfectly
even though its defined the exact same way as the INJURY
table. When I do the INJURY table update, I receive.. -191
SQLE_CANNOT_MODIFY. If I code in some dynamic SQL and try
the same thing.. I get the -187 SQL_CURSOROP_NOT_ALLOWED.


Original Code
ULTREATMENTtable.MoveBeforeFirst
ULTREATMENTtable.FindBegin
ULTREATMENTtable.Column("TREAT_DATE").StringValue =
CurrentTreatmentDate
ULTREATMENTtable.Column("TREATMENT_ID").DoubleValu e =
CurrentTreatmentID
ULTREATMENTtable.FindFirst
ULTREATMENTtable.UpdateBegin
ULTREATMENTtable.Column("TREAT_DATE").StringValue =
lblTreatDate.Caption
ULTREATMENTtable.Update


ULINJURYtable.MoveBeforeFirst
ULINJURYtable.FindBegin
ULINJURYtable.Column("INJ_DATE").StringValue =
CurrentInjuryDate
ULINJURYtable.Column("INJURY_ID").DoubleValue =
CurrentInjuryID
ULINJURYtable.FindFirst
ULINJURYtable.UpdateBegin
ULINJURYtable.Column("INJ_DATE").StringValue =
lblInjDate.Caption
ULINJURYtable.Update

Both tables are opened with the date and id index. The
indexes and tables are defined the same way in the schema.
ULTREATMENTtable.Open "idx_treat_date"
ULINJURYtable.Open "idx_inj_date"


Replaced Dynamic SQL CODE

Set UpdatePS = Connection.PrepareStatement( _
"UPDATE injury set inj_date=? where injury_id = ?")

UpdatePS.SetStringParameter 1, lblInjDate.Caption
UpdatePS.SetDoubleParameter 2, CurrentInjuryID
UpdatePS.ExecuteStatement
ULINJURYtable.Update



Are you doing a cursor update using a result set? If so
I'd guess that you were missing an UpdateBegin() call.

Alternatively you can update with out a cursor using the
following SQL

update ULINJURY set INJ_DATE = "11/6/2007" where id = ?

If that doesn't help, please post the lines of code that
you used to do the update.

Mike

Jeff> wrote in message
news:47308bac.326b.1681692777 (AT) sybase (DOT) com... Thanks
Mike.. I tried to use the sql update and I now receive
-187
SQLE_CURSORDROP_NOT_ALLOWED

It's almost like that field is locked since I opened a
connection to the table when I start the application.

ULINJURYtable.Open "idx_inj_date"


You can not update a column in the index that the table
object is using. By default table objects use the
primary key, but they can be opened using any index on
the table.

Your options to get around this are...
- Open a table object on a different index.
- Use a sql update statement.

Mike

Jeff> wrote in message
news:47308132.314e.1681692777 (AT) sybase (DOT) com... 9.0.2
Build >> 3575
When assigning the date value to the "INJ_DATE" field
in >> > an Update, I receive...

Runtime error -191
SQLE_CANNOT_MODIFY

ULINJURYtable.UpdateBegin
UNINJURYtable.Column("INJ_DATE").StringValue =
"11/6/2007"
The INJ_DATE field is part of an index in the table
schema.
Why am I getting this error?

Thanks,
Jeff.







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.