Click here to Skip to main content
15,916,379 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hye all..I am facing a problem to pass the result from query to a label.
When I try with a gridview like code below, it works (displaying 'SEP3FM' in the gridview). However when I replace the code to ;
Dim loc1 As String = OracleDbLib.OracleDbBase.ExcuteScalar(sqlDATE)
Me.lblLoc.Text = loc1
it shows no error but nothing appear. When I debug, the 'loc1' value contains "Nothing". The result is in varchar datatype.How to display the value in label? Thanks for your help guys. :)

Dim sqlDATE As String = " Select DVLPER.MANUFACTURERESULTS.WORKWARD" & _
                                " From (Select Max(DVLPER.MANUFACTURERESULTS.RESULTINPUTNO) As MAX1" & _
                                " From(DVLPER.MANUFACTURERESULTS)" & _
                                " Where DVLPER.MANUFACTURERESULTS.JOBNO = '404001039232') DB1 Inner Join" & _
                                " DVLPER.MANUFACTURERESULTS On DB1.MAX1 =" & _
                                " DVLPER.MANUFACTURERESULTS.RESULTINPUTNO"

Dim loc1 As DataTable = OracleDbLib.OracleDbBase.BuildDataTable(sqlDATE)
GridView2.DataSource = loc1
GridView2.DataBind()
Posted
Updated 22-May-12 14:11pm
v2

Whats the return type of OracleDbLib.OracleDbBase.ExcuteScalar(sqlDATE) I think you need to cast it to string.

Regards
Sebastian
 
Share this answer
 
Comments
snamyna 23-May-12 1:18am    
stated in OracleDbBase definition is ExcuteScalar(String) As Object. Or where shud I change it?
Sebastian T Xavier 23-May-12 2:17am    
Can you add a watch while debugging and see what is stored in this(loc1)?
snamyna 23-May-12 5:44am    
The results is String at type column.
Hi,

you may try
VB
Me.lblLoc.Text = loc1.Rows[0][0].toString();

Hope its help u

Best Luck
 
Share this answer
 
Comments
Sebastian T Xavier 23-May-12 0:55am    
Will this work with following code?
Dim loc1 As String = OracleDbLib.OracleDbBase.ExcuteScalar(sqlDATE)
Nilesh Patil Kolhapur 23-May-12 6:40am    
yes add .toString() at end
snamyna 23-May-12 20:13pm    
By using Rows[0][0], do u mean that I need to pass the value from gridview into the label? I am inteding to remove the gridview and straightly display the value into the label.

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