Android Question CANNOT GET ID - SQL NEED HELP

lucas555

Member
Licensed User
Longtime User
Hello all,

I'am having a problem of getting an ID from the data base.
This is my Code

Dim PickingSlipNo

Query = "SELECT MAX([PickingNo]) As PickingNo" & CRLF & _
"Table1" & CRLF & _
"WHERE [dbo].[OE_PICKINGSLIP_Header].[OrderNo] = " & OrderNo

openconn
Conn.ExecuteQuery(Query)
PickingSlipNo = conn.ReadField("PickingNo")

The openconn Is a method that opens the connection to the DB. The connection is function I have tested it out.

In the PickingSlipNo variable it always return #ERROR# for some reason, all I want him to do is to get the ID of a precise OrderNo.

Need Help with it please help.
 
Many Thanks for you're answer, but I've tried what you wrote but sadly there's no such thing as Cursor
is it a library that you've added ?

I'am using Basic4ppc As program, so maybe the syntax is different ...

Please help need help it's a bit Urgent.

Regards
 
Upvote 0
Code: Copy
Query = "SELECT MAX([PickingNo]) As PickingNo" & CRLF & _
"Table1" & CRLF & _
"WHERE [dbo].[OE_PICKINGSLIP_Header].[OrderNo] = " & OrderNo

This query looks like it's missing a "FROM" keyword?

Code: Copy
Query = "SELECT MAX([PickingNo]) As PickingNo" & CRLF & _
"FROM Table1" & CRLF & _
"WHERE [dbo].[OE_PICKINGSLIP_Header].[OrderNo] = " & OrderNo
 
Upvote 0
Back
Top