T
Teep
Where there is a duplicate invoice, I want to stop the process and
post to the user on the same page and not continue to the next
page...I tried Return or Exit Sub...but still the same thing occurs.
Sub Close1Open2(Source as Object, E as EventArgs)
pnl1.visible="false"
pnl2.visible="false"
pnl3.visible="false"
pnl4.visible="true"
Dim strConn as string =
"server=abcd;database=cds;trusted_connection=true"
Dim MySQL as string = "Select supplier_cd, inv_no, inv_date from
view_cds_all where supplier_cd='" & txtSupCD.text & "' and inv_no='" &
txtInvNum.text & "' and inv_date='" & txtInvDate.text & "'"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
MyConn.Open()
objDR=Cmd.ExecuteReader()
While objDR.Read()
If IsDbNull(objDR.GetString(0))=False Then
blHasRows="True"
else
blHasRows="False"
End If
End While
MyConn.Close()
MySQL = "Insert into a_p.dbo.tbl_ap_web_ce_inv_terms (splr_cd,
inv_numb, inv_dat) Values ('" & txtSupCD.text & "','" & txtInvNum.text
& "'," & txtInvDate.text & ")"
Dim Cmd2 as New SQLCommand(MySQL, MyConn)
if blHasRows="False" then
MyConn.Open()
Cmd2.ExecuteNonQuery()
lblResults.text="Your information has been received!"
MyConn.Close
else
lblResults.text="Sorry, that information is already in the
database"
End If
End Sub
post to the user on the same page and not continue to the next
page...I tried Return or Exit Sub...but still the same thing occurs.
Sub Close1Open2(Source as Object, E as EventArgs)
pnl1.visible="false"
pnl2.visible="false"
pnl3.visible="false"
pnl4.visible="true"
Dim strConn as string =
"server=abcd;database=cds;trusted_connection=true"
Dim MySQL as string = "Select supplier_cd, inv_no, inv_date from
view_cds_all where supplier_cd='" & txtSupCD.text & "' and inv_no='" &
txtInvNum.text & "' and inv_date='" & txtInvDate.text & "'"
Dim MyConn as New SQLConnection(strConn)
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
MyConn.Open()
objDR=Cmd.ExecuteReader()
While objDR.Read()
If IsDbNull(objDR.GetString(0))=False Then
blHasRows="True"
else
blHasRows="False"
End If
End While
MyConn.Close()
MySQL = "Insert into a_p.dbo.tbl_ap_web_ce_inv_terms (splr_cd,
inv_numb, inv_dat) Values ('" & txtSupCD.text & "','" & txtInvNum.text
& "'," & txtInvDate.text & ")"
Dim Cmd2 as New SQLCommand(MySQL, MyConn)
if blHasRows="False" then
MyConn.Open()
Cmd2.ExecuteNonQuery()
lblResults.text="Your information has been received!"
MyConn.Close
else
lblResults.text="Sorry, that information is already in the
database"
End If
End Sub