Dim qry="select max(ID) from tbl_deal where officeid='" & ddl1.SelectedValue.Trim & "'" dun cmd1 as sqlCommand=New SqlCommand(qry,conn) conn.open() dim read As SqlDataReader=cmd1.ExecuteReader() read.Read() Dim a=0 if(read.HasValue) Then a=read(0) endif a=a+1
select COALESCE(max(ID),0) from tbl_deal where officeid=@officeid
DbNull
If not read(0)= DBNull.Value Then a=read(0) end if
if Convert.ToString(read(0))<>"" Then a=read(0) else a=a+1 Endif
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)