|
Home > Archive > SQL Anywhere ultralite > February 2006 > SQLE_CANNOT_MODIFY
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 |
SQLE_CANNOT_MODIFY
|
|
| Stefano 2006-02-07, 11:23 am |
| hi to everyone,
I'm working on an application for PocketPC 2003 written in dotNET Compact
Framework (language C#) v. 1.1 that uses database Ultralite v. 9.0.2,
In the application i've referenced the library iAnywhere.Data.UltraLite.
I get the error "SQLE_CANNOT_MODIFY" when i use the method SetString that i
am not able to understand and solve. The code is :
// conn is an open connection to a local ultralite database
//uld is an alias for iAnywhere.Data.UltraLite
uld.ULCommand cmd = conn.CreateCommand();
cmd.CommandText =
@"CREATE TABLE ARTICO (
Gruppo1 varchar(4),
Gruppo2 varchar(4),
CodiceArticolo varchar(15),
DescrizioneArticolo varchar(30),
PRIMARY KEY (
Gruppo1,Gruppo2)
)";
cmd.ExecuteNonQuery();
cmd.CommandText = @"CREATE INDEX IDX_CODICE_ARTICOLO ON ARTICO
(CodiceArticolo)";
cmd.ExecuteNonQuery();
cmd.CommandText = "insert into ARTICO
(Gruppo1,Gruppo2,Cod
iceArticolo,Descrizi
oneArticolo) values
('gr1','gr2','1500',
'articolo 1')";
cmd.ExecuteNonQuery();
// i want to find a particular record in the table ARTICO
cmd.CommandType = System.Data.CommandType.TableDirect;
cmd.CommandText = "ARTICO";
uld.ULTable _ULTable = cmd.ExecuteTable();
uld.ULIndexSchema _indexSchema =
_ULTable.Schema.GetIndex("IDX_CODICE_ARTICOLO");
_ULTable.FindBegin();
string colName = _indexSchema. GetColumnName((short
)(1));
short columnID = _ULTable.Schema. GetColumnID(colName)
;
// ====================
====================
===========
_ULTable.SetString(columnID, "1500"); // this causes the error
SQLE_CANNOT_MODIFY !!!!!!!
// ====================
====================
===========
bool recordFound = _ULTable.FindFirst(); //this should return if the
record was found
Please, where is my mistake ?
Thanks in advance
Stefano
| |
| Stefano 2006-02-07, 11:23 am |
| sorry, i forgot to write that the purpose of the routine is to seek for a
record in the table "ARTICO"
"Stefano" <stefanob@aton.it> ha scritto nel messaggio
news:43e8cdb0$1@foru
ms-1-dub...
> hi to everyone,
> I'm working on an application for PocketPC 2003 written in dotNET Compact
> Framework (language C#) v. 1.1 that uses database Ultralite v. 9.0.2,
> In the application i've referenced the library iAnywhere.Data.UltraLite.
>
> I get the error "SQLE_CANNOT_MODIFY" when i use the method SetString that
> i am not able to understand and solve. The code is :
>
> // conn is an open connection to a local ultralite database
> //uld is an alias for iAnywhere.Data.UltraLite
>
> uld.ULCommand cmd = conn.CreateCommand();
>
> cmd.CommandText =
> @"CREATE TABLE ARTICO (
> Gruppo1 varchar(4),
> Gruppo2 varchar(4),
> CodiceArticolo varchar(15),
> DescrizioneArticolo varchar(30),
> PRIMARY KEY (
> Gruppo1,Gruppo2)
> )";
> cmd.ExecuteNonQuery();
>
> cmd.CommandText = @"CREATE INDEX IDX_CODICE_ARTICOLO ON ARTICO
> (CodiceArticolo)";
> cmd.ExecuteNonQuery();
>
> cmd.CommandText = "insert into ARTICO
> (Gruppo1,Gruppo2,Cod
iceArticolo,Descrizi
oneArticolo) values
> ('gr1','gr2','1500',
'articolo 1')";
> cmd.ExecuteNonQuery();
>
> // i want to find a particular record in the table ARTICO
> cmd.CommandType = System.Data.CommandType.TableDirect;
> cmd.CommandText = "ARTICO";
> uld.ULTable _ULTable = cmd.ExecuteTable();
> uld.ULIndexSchema _indexSchema =
> _ULTable.Schema.GetIndex("IDX_CODICE_ARTICOLO");
>
> _ULTable.FindBegin();
> string colName = _indexSchema. GetColumnName((short
)(1));
> short columnID = _ULTable.Schema. GetColumnID(colName)
;
> // ====================
====================
===========
> _ULTable.SetString(columnID, "1500"); // this causes the error
> SQLE_CANNOT_MODIFY !!!!!!!
> // ====================
====================
===========
> bool recordFound = _ULTable.FindFirst(); //this should return if the
> record was found
>
>
> Please, where is my mistake ?
> Thanks in advance
> Stefano
>
>
>
>
>
| |
| Stefano 2006-02-08, 9:23 am |
| solved !
It is necessary to indicate IndexName so :
cmd.CommandType = System.Data.CommandType.TableDirect;
cmd.IndexName = "IDX_CODICE_ARTICOLO"; // !!!!!!
cmd.CommandText = "ARTICO";
uld.ULTable _ULTable = cmd.ExecuteTable();
Stefano
"Stefano" <stefanob@aton.it> ha scritto nel messaggio
news:43e8cdb0$1@foru
ms-1-dub...
> hi to everyone,
> I'm working on an application for PocketPC 2003 written in dotNET Compact
> Framework (language C#) v. 1.1 that uses database Ultralite v. 9.0.2,
> In the application i've referenced the library iAnywhere.Data.UltraLite.
>
> I get the error "SQLE_CANNOT_MODIFY" when i use the method SetString that
> i am not able to understand and solve. The code is :
>
> // conn is an open connection to a local ultralite database
> //uld is an alias for iAnywhere.Data.UltraLite
>
> uld.ULCommand cmd = conn.CreateCommand();
>
> cmd.CommandText =
> @"CREATE TABLE ARTICO (
> Gruppo1 varchar(4),
> Gruppo2 varchar(4),
> CodiceArticolo varchar(15),
> DescrizioneArticolo varchar(30),
> PRIMARY KEY (
> Gruppo1,Gruppo2)
> )";
> cmd.ExecuteNonQuery();
>
> cmd.CommandText = @"CREATE INDEX IDX_CODICE_ARTICOLO ON ARTICO
> (CodiceArticolo)";
> cmd.ExecuteNonQuery();
>
> cmd.CommandText = "insert into ARTICO
> (Gruppo1,Gruppo2,Cod
iceArticolo,Descrizi
oneArticolo) values
> ('gr1','gr2','1500',
'articolo 1')";
> cmd.ExecuteNonQuery();
>
> // i want to find a particular record in the table ARTICO
> cmd.CommandType = System.Data.CommandType.TableDirect;
> cmd.CommandText = "ARTICO";
> uld.ULTable _ULTable = cmd.ExecuteTable();
> uld.ULIndexSchema _indexSchema =
> _ULTable.Schema.GetIndex("IDX_CODICE_ARTICOLO");
>
> _ULTable.FindBegin();
> string colName = _indexSchema. GetColumnName((short
)(1));
> short columnID = _ULTable.Schema. GetColumnID(colName)
;
> // ====================
====================
===========
> _ULTable.SetString(columnID, "1500"); // this causes the error
> SQLE_CANNOT_MODIFY !!!!!!!
> // ====================
====================
===========
> bool recordFound = _ULTable.FindFirst(); //this should return if the
> record was found
>
>
> Please, where is my mistake ?
> Thanks in advance
> Stefano
>
>
>
>
>
|
|
|
|
|