|
-
March 29th, 2010, 04:38 PM
#1
Sql vb
I have two databases in sql 2005
there is one table in each database called tbl200
this table has 2 fields called invoice no ,and supplier no
when the user enters an invoice in any of the two tables through a vb form I want the system to check whether this invoice number for this supplier already exists in any of the two databases or not.
How can I achieve that ?
Many thanks
Sandra
gonewild at muchomail.com
-
March 29th, 2010, 04:59 PM
#2
Re: Sql vb
Using ADO you would open two connections to each of the databases.
Next you would open a Recordset with a query string of like "where invoice_number = xxx" from one connection.
Next you open a similar Recordset from the second connection.
The apropriate invoice number exists if the Recordset opened is not at EoF.
I think this is an abstract description as close as possible to your abstract description of the solution you are searching for.
-
March 29th, 2010, 05:02 PM
#3
Re: Sql vb
Sounds like you need to design your DB better. There should be a unique key to both tables
-
March 31st, 2010, 03:41 AM
#4
Re: Sql vb
In your code you should have one connection each to the databases. Either you can use the method given by Wof or you can open two different recordset for each database and use
RS.Find method to find a specific record. If record doesnot exist Rs.eof will be true otherwise false, with above hints you can build your own logic and apply to your code.
Encourage the efforts of fellow members by rating
Lets not Spoon Feed and create pool of lazy programmers
- ComIT Solutions
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|