D
Dudge669
What is the best way to do this? I have access to a readonly sql
database with information about people - first, last, address & social
security number, etc and I want to display this information in a vb.net
datagrid. That part I have down and I use a dataadapter to populate my
dataset, etc etc. What I'm getting hung up on is the fact that I need
to also merge into this grid information from a separate database on a
different server that has "person ids" associated with social security
numbers.
My grid will only have at most between 300-500 records in it with
addresses and ssn's, etc of people of recent interest and I need to
query this other database with 'person ids' and ssns which has around
70,000 records. I have a very slow solution right now that loops
through the grid after first populating from database A, looking up
each ssn in table B and populating the missing fields in the columns.
This process takes between 1 to 2 minutes to do this lookup. I tried
adding an index on the ssn column in table B but that didn't help much.
Database A is offsite and I have readonly access to it.
I looked into using the .Merge function after first retrieving all
70,000 records from database B into a dataset and setting primary keys
on SSN but it didn't work. I read information about rowstate and how it
has to be set a certain way and to try setting the dataadapter's
AcceptChangesDuringFill property = False so that the rows have a state
of 'added' to get the merge to work but it's not working and I really
can't figure out why.
Another option I'm thinking of doing is after retrieving the 300-500
records from database A, creating a temporary table in database B on my
local sql server here and then just doing something like:
SELECT tablea.first, tablea.last, tablea.address, tablea.ssn,
tableB.personid where tabela.ssn=tableb.ssn
But I would like to avoid the temporary table creation/fill/destroy
method as this may soon be run quite a few times a day concurrently by
many people. I have been working with VB for quite a few years and SQL
off and on for a few years. I'm no expert in sql but I know there must
be some way to do this easier.
What is my best approach to this problem? Many thanks!
database with information about people - first, last, address & social
security number, etc and I want to display this information in a vb.net
datagrid. That part I have down and I use a dataadapter to populate my
dataset, etc etc. What I'm getting hung up on is the fact that I need
to also merge into this grid information from a separate database on a
different server that has "person ids" associated with social security
numbers.
My grid will only have at most between 300-500 records in it with
addresses and ssn's, etc of people of recent interest and I need to
query this other database with 'person ids' and ssns which has around
70,000 records. I have a very slow solution right now that loops
through the grid after first populating from database A, looking up
each ssn in table B and populating the missing fields in the columns.
This process takes between 1 to 2 minutes to do this lookup. I tried
adding an index on the ssn column in table B but that didn't help much.
Database A is offsite and I have readonly access to it.
I looked into using the .Merge function after first retrieving all
70,000 records from database B into a dataset and setting primary keys
on SSN but it didn't work. I read information about rowstate and how it
has to be set a certain way and to try setting the dataadapter's
AcceptChangesDuringFill property = False so that the rows have a state
of 'added' to get the merge to work but it's not working and I really
can't figure out why.
Another option I'm thinking of doing is after retrieving the 300-500
records from database A, creating a temporary table in database B on my
local sql server here and then just doing something like:
SELECT tablea.first, tablea.last, tablea.address, tablea.ssn,
tableB.personid where tabela.ssn=tableb.ssn
But I would like to avoid the temporary table creation/fill/destroy
method as this may soon be run quite a few times a day concurrently by
many people. I have been working with VB for quite a few years and SQL
off and on for a few years. I'm no expert in sql but I know there must
be some way to do this easier.
What is my best approach to this problem? Many thanks!