Re: SQL Server Mobile Table Index

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



When a transaction commits the table data and its indexes are up to date.
I don't use transaction on SQL Server mobile but I think the inserts
are autocommited then. Here is the related part of my code which
inserts the data:

String SQL = "Insert into <table>
(ItemNo,Location,NumberAvail,WarehouseNo,rowguid ) ";
SQL += string.Format(" values('{0}','AUTO',{1},'{2}','{3}')",
aItem.ItemNo, 0, aItem.Storage, Guid.NewGuid().ToString());

using (SqlCeCommand cmd = CreateCommand(SQL, <connection string>))
{
return (cmd.ExecuteNonQuery() > 0);
}

I guess after executing there is no transaction pending so the indexes
are hopefully updated but i don't find the new records after scanning
the index with direct index scan (CommandType.TableDirect)

Thanks
Roman

.