[VNET 1.0] Error wirth VCursor.Add + Update Methods

SoftIl softil at onlinehome.de
Fri Mar 10 00:34:12 CST 2006


Hi Ruslan,
if I run the following code (code is from your VNET-Excample "Sample3") I get an exception "Can't be updated" if I call c.Add().
I get the same exception if I call c.Update() for existing records.

try
{
    Valentina.Init(6 * 1024 * 1024, String.Empty);
    using(VDatabase db = new VDatabase())
    {
        db.Create("Sample3");
        VBaseObject t = db.CreateTable("T1");
        t.CreateField("ID", FieldType.kLong);
        t.CreateField("BLOB", FieldType.kBLOB, 1024);
        Byte [] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
        using(VCursor c = db.SqlSelect("SELECT ID, BLOB FROM T1 WHERE RecID=0"))
        {
            for(int i = 0; i < 100; i++)
            {
                c.SetBlank();
                c[1] = i;
                (c[2] as VBLOB).WriteBLOBData(data);
                c.Add();
            }
        }
    }
    Console.Read();
    Valentina.Shutdown();
}
catch(Exception ex)
{
    Console.WriteLine(ex.Message);
}


Where is the mistake?

Another Question:
How can I write data in an db field of type BLOB with the "dataBase.SqlExecute(_commandString,_paramsArray)"?
The "_paramsArray" can be only from type string[]. But I'd like to write an byte[] in my blob-field.
How can I do that?

Thanks for your help.

Best regards,
Carsten


More information about the Valentina mailing list