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

Coding not working in adodc control : v.b 6.0

P: 31
Hi all,

Can anyone tell me how to get a record for particular field, in my sql i,v Pinvoice table following fields

InvNo int ItemNo int Descrption varchar(20) Price float Qty Gross float
1001 090 Fan 30 5 150
1001 080 Table 45 2 90
1002 012 Chair 90 3 270
1002 001 ToolBox 120 1 120

now t want to see the particular invNo details in datagrid when i type the particular invNo(for example InvNo =1001) in a textbox so what should i do to get the result.
i tried this ways but no result it showed me the error

1. in a Adodc control Recordsource command type AdcmdText i added the following code select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=&

it showed me error msg Incorrect syntex near&" as well page loading & close

so i tried to give the datasource at run time, in a button click event i added this query

sqlstring
sqlstring = "select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=& txtTest.Text"
Adodc1.RecordSource = sqlstring

it also showed me error msg

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

plz help me to solve this problem
Apr 16 '08 #1
Share this Question
Share on Google+
6 Replies


debasisdas
Expert 5K+
P: 8,127
Try to use this
Expand|Select|Wrap|Line Numbers
  1. sqlstring = "select ItemNo,Descrp,Rate,Qty,Gross from Pinvoice where InvNo=" & "'" & txtTest.Text & "'" 
Apr 16 '08 #2

P: 31
Thanx Debidas i used that query which u sent but still i,m facing the same error , is there any solution plzzzzzzzzzzzzzzzzzzzzzzzz

and also tell me how to set the total in datareport and datagrid for examples i,v some regards in datagrid and i need the grand total in a textbox in my form

i created a view create view[Total ]as select sum(Gross)as total from Pinvoice

but it showed me the all Gross sum, if i need a particular Supplier how can i do it

in sql we can give like that "select sum(Gross)as total from Pinvoice where InvNo=1001"
but in form how can we do it plz i need ur suggestion
Apr 16 '08 #3

debasisdas
Expert 5K+
P: 8,127
in sql we can give like that "select sum(Gross)as total from Pinvoice where InvNo=1001"
what is the problem if you are using the SQL and pass the value at run time ?
Apr 16 '08 #4

P: 31
Dear Debasis

Actually i need the total for particular InvNo so i tried many ways, in sql we can simply use this query "select sum(Gross)as Total from Pinvoice where InvNo=1001" but in my form when i retrive the datas from sql how i make the total thats my question is ? , shall i use the same query in button event

string sql
sqlstring"select sum(Gross)as Total from Pinvoice where InvNo="&"'"&txtInvNo.Text&"'"
Adodc1.RecordSource = sqlstring
Adodc1.Refresh
but i doesn,t show me the Total
Apr 16 '08 #5

debasisdas
Expert 5K+
P: 8,127
You can use two separate controls one for the record and the second for the total.

If using ADODB then can open 2 separate recordset for the purpose.
Apr 16 '08 #6

P: 1
You have to choose good driver provider. so it may make strong binding with all defined control.
Jun 22 '11 #7

Post your reply

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