Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic - Database ----HELP NEEDED

Status
Not open for further replies.

KISA

Technical User
Apr 20, 2004
10
US
Hello Guys:

I have a question:
can you access with one SELECT statement 2 tables in one database.

thank you
[gorgeous]
 
Yes you can, just do:

Select a.value, b.value
from table1 a, table2 b
where a.keyfield = b.keyfield
 
You may even want to use a JOIN statement so that you don't get duplicate returns

Example: Select Table.Field, Table1.Field, Table1.Field1 FROM Table INNER JOIN Table1 ON Table.Field = Table1.Field
 
For a fast result, try using MS Access Query utilizy. Create the table links, test for erors, and then select the sql view and copy the instruction to your Visual Basic apps.

I always use this method, it is faster and ERROR PROOF.

Upps; Enclosed the select statement with "". Also if using LIKE instruction dont use the *, use the %

 
PcProgrammer I should have said that too.
I also always have Access build my sql statements, they are easy to do and I don't mess up the joins then.

TheKing
 
I want to import data from either of the file formats like excel sheet(.xls) or simple text file (.txt,- separated by any delimiter)to a SQL Server 7.0 database table using VB as a frontend package.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top