locate methods for cursor

Sims, John (CDC/NCBDDD/DBDDD) (CTR) ayu8 at cdc.gov
Tue Jun 27 14:50:25 CDT 2006


 
> >> To clarify. So steps are next?
> >> 
> >>     curs = db.SqlSelect( "select f1, f2, f3, FROM T1 ..." )
> >> 
> >>     curs.PrimaryKey = f2    // f2 must have unique values...
> >> 
> >>     curs.Find( v2 )  // move cursor to record that have in 
> f2 value 
> >> v2.
> >>         
> >> 
> >> Right ?
> >> 
> >> 
> >> --
> >> Best regards,
> >> 
> >> Ruslan Zasukhin
> >> VP Engineering and New Technology
> >> Paradigma Software, Inc
> > 
> > Hi Ruslan,
> > 
> > Yes, that is very much how the .NET Datatable works.  The 
> only thing I 
> > would point out is that the .NET Datatable allows you to 
> use multiple 
> > column PrimaryKey by making PrimaryKey an array of 
> Datacolumns.  Using 
> > your example, it might look more like this.
> > 
> > Dim pk() as Vfield
> > 
> > curs = db.SqlSelect( "select f1, f2, f3, FROM T1 ..." )
> > 
> > Pk.append(f2)
> >  
> > curs.PrimaryKey = pk    // f2 must have unique values...
> > 
> > Dim vals() as string
> > 
> > Vals.append(v2)
> > 
> > curs.Find( Vals )  // move cursor to record that have in f2 
> value v2.
> 
> I see, but note that we not support multi-column PKs even for Tables.
> 
> 
> --
> Best regards,
> 
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
> 

Right.  In .NET, the "Primary Key" you define for the Datatable is not
necessarily the PK for the table.  The Datatable.PrimaryKey is defined
by the developer to enable searchability.  The Datatable may contain
data from several joined tables.  As long as the developer knows that a
certain column or set of columns will be unique, he/she can define them
as the Datatable.PrimaryKey so that they can locate records in the
Datatable more easiliy.

Does that make sense?

-John




More information about the Valentina mailing list