Click here to Skip to main content
15,903,362 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:49
AjitMourya16-Aug-09 19:49 
AnswerRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 3:02
professionalEddy Vluggen16-Aug-09 3:02 
GeneralRe: code to find max orderno Pin
Zizo_nis16-Aug-09 3:50
Zizo_nis16-Aug-09 3:50 
GeneralRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 5:05
professionalEddy Vluggen16-Aug-09 5:05 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:58
AjitMourya16-Aug-09 19:58 
GeneralRe: code to find max orderno Pin
Eddy Vluggen16-Aug-09 21:10
professionalEddy Vluggen16-Aug-09 21:10 
GeneralRe: code to find max orderno Pin
AjitMourya16-Aug-09 19:30
AjitMourya16-Aug-09 19:30 
AnswerRe: code to find max orderno Pin
Johan Hakkesteegt16-Aug-09 21:01
Johan Hakkesteegt16-Aug-09 21:01 
The problem is that if your query does not return any results, there will be no rows, and therefore no value can be assigned to your integer.
Using ISNULL, will not necessarily work either. It also can return zero rows.

So you can either count the rows after
AjitMourya wrote:
rss.Open("select max(orderno) As ono from measurementpant where custno='" & txtcustno.Text & "' AND length<>0 ")

and before
AjitMourya wrote:
no = Convert.ToInt32(rss.Fields("ono").Value)

or you can force a result in your query, and then take that into account when you assign the value to your integer:
rss.Open("select (1 + ISNULL(max(orderno),0)) As ono from measurementpant where custno='" & txtcustno.Text & "' AND length<>0 ")
no = (Convert.ToInt32(rss.Fields("ono").Value) - 1)


My advice is free, and you may get what you paid for.

QuestionVB Sql check and insert if then command Pin
Brav0116-Aug-09 0:56
Brav0116-Aug-09 0:56 
AnswerRe: VB Sql check and insert if then command Pin
Moreno Airoldi16-Aug-09 1:12
Moreno Airoldi16-Aug-09 1:12 
GeneralRe: VB Sql check and insert if then command Pin
Brav0116-Aug-09 2:02
Brav0116-Aug-09 2:02 
AnswerRe: VB Sql check and insert if then command Pin
Paramu197316-Aug-09 20:20
Paramu197316-Aug-09 20:20 
QuestionUnchecking a checked box... Answered,thanks. Pin
Laser Steve15-Aug-09 6:26
Laser Steve15-Aug-09 6:26 
AnswerRe: Unchecking a checked box Pin
Dave Kreskowiak15-Aug-09 6:45
mveDave Kreskowiak15-Aug-09 6:45 
AnswerRe: Unchecking a checked box... Answered,thanks. Pin
Laser Steve15-Aug-09 7:15
Laser Steve15-Aug-09 7:15 
QuestionComboLost focus problem.? Pin
mdrizwan_115-Aug-09 2:54
mdrizwan_115-Aug-09 2:54 
AnswerRe: ComboLost focus problem.? Pin
riced15-Aug-09 3:04
riced15-Aug-09 3:04 
QuestionOutlook Contact list Read Only Problem Pin
dcdhingra14-Aug-09 23:15
dcdhingra14-Aug-09 23:15 
QuestionGoogle Mapping... Pin
mdrizwan_114-Aug-09 20:09
mdrizwan_114-Aug-09 20:09 
AnswerRe: Google Mapping... Pin
Dave Kreskowiak15-Aug-09 6:42
mveDave Kreskowiak15-Aug-09 6:42 
QuestionHow to Generate data on Crystal Report when Datagridview item is selected Pin
Dambod14-Aug-09 7:50
Dambod14-Aug-09 7:50 
AnswerRe: How to Generate data on Crystal Report when Datagridview item is selected Pin
Dave Kreskowiak14-Aug-09 8:10
mveDave Kreskowiak14-Aug-09 8:10 
GeneralRe: How to Generate data on Crystal Report when Datagridview item is selected Pin
Dambod14-Aug-09 8:25
Dambod14-Aug-09 8:25 
GeneralRe: How to Generate data on Crystal Report when Datagridview item is selected Pin
Dave Kreskowiak14-Aug-09 8:35
mveDave Kreskowiak14-Aug-09 8:35 
GeneralRe: How to Generate data on Crystal Report when Datagridview item is selected Pin
Paramu197314-Aug-09 19:46
Paramu197314-Aug-09 19:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.