By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

How to get records in two table with one same datafield: v.b 6.0

P: 31
Dear all,

I,m doing a application in v.b 6.0 and can anyone solve my issue plz tell me how to retrive the two tables in a same time with one commonfield

Pinvoice1(Table1) Pinvoice2(Table2)
............... .................
InvNo Primary key InvNo foreign key refrence Pinvoice(InvNo)
SupId int ItemNo int
Supname varchar(20) Descrp varchar(20)
Pdate datetime Price float
Qty int
Gross
(i made it to avoid the repeated value of SupId,Supname,Pdate)

i need the out put when i type the invoice number in a textbox the first table datas in textboxes and the second table datas in a datagrid

so i used 2 Adodc control and in one control i specify the table name

in 1st adodc control Recordsource adcmdText i used this query
select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where
InvNo=& and drag a datagrid and given the datasource as adodc1
but when i tried to run my form it showed me error msg
"Incorrect syntex near&" as well page loading & close


Then i draged a button and textbox in the button click event i used this query
Dim sqlstring
sqlstring = "select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=& txtTest.Text"
Adodc2.RecordSource = sqlstring
Adodc2.Refresh

it also showed me the error msges like
1. "Microsoft[ODBC Driver manager]datasource name not found" so i droped it.
2."Incorrect syntex near&"
3.Method 'Refresh' of object 1Adodc failed"

so what is the mistake in my coding and how to specify for parricular record
Apr 16 '08 #1
Share this Question
Share on Google+
1 Reply


debasisdas
Expert 5K+
P: 8,127
try to do that using SQl statement.

Better to use ADODB instead of ADODC.
Apr 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.