Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my coding is like this
VB
dim quer as string
dim a as integer
dim dr as OracleDataReader

query = select max(refno)+1 from porder;
orc.open()
cmd = New OracleCommand(query1, orc)
dr = cmd.ExecuteReader()
a = dr.read()


each time it is showing the zero(0)

please help and thanks in advance
Posted
Updated 17-Jul-11 0:50am
v2
Comments
Uday P.Singh 17-Jul-11 7:04am    
I assume that dim quer as string is dim query as string.

1 solution

try this :

replace this:

SQL
query = select max(refno)+1 from porder;
orc.open()
cmd = New OracleCommand(query1, orc)


with:

SQL
query = select max(refno)+1 from porder;
orc.open()
cmd = New OracleCommand(query, orc)


as you are passing the incorrect query.

hope it helps :)
 
Share this answer
 
v2
Comments
RaisKazi 17-Jul-11 7:02am    
Good Catch :). My 5 . Also "ExecuteScalar" can be used here, as this query is always going to return only one value.
Uday P.Singh 17-Jul-11 7:08am    
yeah RaisKazi, you are right ExecuteScalar can be used(as this query is always going to return single value). thanks for 5!
asok6783 17-Jul-11 7:12am    
ERROR IS NOT THAT IT IS THE TYPING ERROR
Uday P.Singh 17-Jul-11 7:17am    
are you getting any error message? if yes then post it, you can always debug your code and check what values you are getting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900