F
Fred Nelson
Hi:
I have built and loaded a datatable with three columns and defined the
first as a primary key as below:
' define datatable
dim fvtable as new DataTable
dim fvrow as DataRow
fvtable.Columns.Add("fvident", GetType(String))
+ two more columns
' define primary key
DIM PrimaryKeyColumns(0) as DataColumn
PrimaryKeyColums(0) = fvtable.columns("fvident")
fvtable.PrimaryKey = PrimaryKeyColumns
In this application I'm not looking to databind or set relations to
other tables - I need to create a cycle that will access data in several
locations and allow me to generate form letters - so I must process this
myself.
So: Now that I have it in a DataTable I can't figure out how to:
1) Go to the top and process sequentially in the order of the primary
key: (logically)
datatable.gototop
while datatable.read
// actions
end while
2) perfrom a direct lookup:
dim soughtkey as string = "ABC"
datable.read.keyvalue = soughtkey
if found
// process found
else
// process not found
endif
I've looked all over MSDN and the web and can't find any examples of how
to do this so any and all help would be GREATLY appreciated!
Thanks,
Fred
I have built and loaded a datatable with three columns and defined the
first as a primary key as below:
' define datatable
dim fvtable as new DataTable
dim fvrow as DataRow
fvtable.Columns.Add("fvident", GetType(String))
+ two more columns
' define primary key
DIM PrimaryKeyColumns(0) as DataColumn
PrimaryKeyColums(0) = fvtable.columns("fvident")
fvtable.PrimaryKey = PrimaryKeyColumns
In this application I'm not looking to databind or set relations to
other tables - I need to create a cycle that will access data in several
locations and allow me to generate form letters - so I must process this
myself.
So: Now that I have it in a DataTable I can't figure out how to:
1) Go to the top and process sequentially in the order of the primary
key: (logically)
datatable.gototop
while datatable.read
// actions
end while
2) perfrom a direct lookup:
dim soughtkey as string = "ABC"
datable.read.keyvalue = soughtkey
if found
// process found
else
// process not found
endif
I've looked all over MSDN and the web and can't find any examples of how
to do this so any and all help would be GREATLY appreciated!
Thanks,
Fred