I have to use vb6 Msgbox (vbyesno) in .net or something similar to that.
I know I can’t use Msgbox and I should use javascript but the problem is, I have to prompt that Messagebox based on the result of a query.
For example:
sql= "select * from users where position = 'manager' and id = '1'"
ds = getdataset(sql,db)
If ds.tables(0).rows.count > 0 Then
If MsgBox("The user is a manager, are you sure you want to delete?", vbYesNo) = vbYes Then
sql = "delete users where id = '1'"
End if
End if
Is this somehow possible? Can I call javascript from the .net code or is there any other way to do this?
Unfortunately No. You need to understand the concept of client-side and server-side programming.
The select & delete portion is server-side programming, while the msgBox is client-side.
What you want is to create a button on the webpage when rows.count > 0; then handle the buttonYES click even to delete the row.
[Edit] I felt my response does not merit as an answer, so I’ve added a bit more details here:
Create a webPage name deleteNow.aspx:
Then, at the Code behind, do this: