469,623 Members | 1,535 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

Radio button error

114 100+
Dear Sir,

I am having a problem in following code :

I have marked the error line in bold:


<html>
<head>
<title>Delete Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim confirm


'MsgBox "sdf"
'confirm = MsgBox("Are you sure want to delete it?", 4, "Confirm")
'If confirm = vbYes Then
'MsgBox "hello"
'ElseIf confirm = vbNo Then
'MsgBox "Sorry"
'End If
'End Sub


'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")



'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

Sub button_onclick()
Dim x

For x = 0 to rsGuestbook.recordcount
If Form1.elements(x).checked = True Then
MsgBox "hello"
End If
Next
End Sub



Response.Write ("<form name='Form1'>")
'Loop through the recordset

Response.Write ("<br><table border=1 bordercolor=red width='50%' style='border-collapse:collapse'>")
Response.Write ("<br><th align='left'>Select here</th><th align='left'>Name</th><th align='left'>Comments</th>")

Do While not rsGuestbook.EOF
'Write the HTML to display the current record in the recordset


'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
'Response.Write ("<br>")
'Response.Write (rsGuestbook("Comments"))
'Response.Write ("<br>")

Response.Write ("<tr><td width='10%' align='center'>")
Response.Write ("<input type='RADIO' name='ID' value='rsGuestbook('ID_no')'>")
'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
Response.Write ("</td><td width='25%'>")
'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write ("<td width='25%'>")
Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td></tr>")


'Move to the next record in the recordset
rsGuestbook.MoveNext

Loop

Response.Write ("</table><br><br>")
Response.Write ("<input type='submit' value='Delete' name='button'>")

Response.Write ("</form>")

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing

%>
</body>
</html>


Please help me sir.

Thanks
Deepak
Dec 7 '06 #1
3 1397
sashi
1,754 Expert 1GB
Dear Sir,

I am having a problem in following code :

I have marked the error line in bold:


<html>
<head>
<title>Delete Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim confirm


'MsgBox "sdf"
'confirm = MsgBox("Are you sure want to delete it?", 4, "Confirm")
'If confirm = vbYes Then
'MsgBox "hello"
'ElseIf confirm = vbNo Then
'MsgBox "Sorry"
'End If
'End Sub


'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")



'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblComments.* FROM tblComments;"

'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon

Sub button_onclick()
Dim x

For x = 0 to rsGuestbook.recordcount
If Form1.elements(x).checked = True Then
MsgBox "hello"
End If
Next
End Sub



Response.Write ("<form name='Form1'>")
'Loop through the recordset

Response.Write ("<br><table border=1 bordercolor=red width='50%' style='border-collapse:collapse'>")
Response.Write ("<br><th align='left'>Select here</th><th align='left'>Name</th><th align='left'>Comments</th>")

Do While not rsGuestbook.EOF
'Write the HTML to display the current record in the recordset


'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
'Response.Write ("<br>")
'Response.Write (rsGuestbook("Comments"))
'Response.Write ("<br>")

Response.Write ("<tr><td width='10%' align='center'>")
Response.Write ("<input type='RADIO' name='ID' value='rsGuestbook('ID_no')'>")
'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
Response.Write ("</td><td width='25%'>")
'Response.Write ("<a href=""delete_entry.asp?ID=" & rsGuestbook("ID_no") & """>")
'Response.Write ("<td width='25%'>")
Response.Write (rsGuestbook("Name"))
'Response.Write ("</a>")
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td></tr>")


'Move to the next record in the recordset
rsGuestbook.MoveNext

Loop

Response.Write ("</table><br><br>")
Response.Write ("<input type='submit' value='Delete' name='button'>")

Response.Write ("</form>")

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing

%>
</body>
</html>


Please help me sir.

Thanks
Deepak
Hi there,

Kindly refer to below modified code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1. Response.Write ("<input type='RADIO' name='ID' value=rsGuestbook("ID_no")>")
  2.  
Dec 8 '06 #2
deepaks85
114 100+
Hi there,

Kindly refer to below modified code segment, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1. Response.Write ("<input type='RADIO' name='ID' value=rsGuestbook("ID_no")>")
  2.  

Dear Sir,

It is working but I am not getting the message box for which I have written the coding:

here is the fresh code:

<html>
<head>
<title>Delete Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim confirm
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.* FROM tblComments;"
rsGuestbook.Open strSQL, adoCon
Sub button_onclick()
Dim x
For x = 0 to rsGuestbook.recordcount
If Form1.elements(x).checked = True Then
MsgBox "hello"
End If
Next
End Sub
Response.Write ("<form name='Form1'>")
Response.Write ("<br><table border=1 bordercolor=red width='50%' style='border-collapse:collapse'>")
Response.Write ("<br><th align='left'>Select here</th><th align='left'>Name</th><th align='left'>Comments</th>")
Do While not rsGuestbook.EOF
Response.Write ("<tr><td width='10%' align='center'>")
Response.Write ("<input type='RADIO' name='ID' value=rsGuestbook('ID_no')>")
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Name"))
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td></tr>")
rsGuestbook.MoveNext
Loop
Response.Write ("</table><br><br>")
Response.Write ("<input type='submit' value='Delete' name='button'>")
Response.Write ("</form>")
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html>


Please help me Sir,

Thanks
Deepak
Dec 8 '06 #3
sashi
1,754 Expert 1GB
Dear Sir,

It is working but I am not getting the message box for which I have written the coding:

here is the fresh code:

<html>
<head>
<title>Delete Entry Select</title>
</head>
<body bgcolor="white" text="black">
<%
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim confirm
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblComments.* FROM tblComments;"
rsGuestbook.Open strSQL, adoCon
Sub button_onclick()
Dim x
For x = 0 to rsGuestbook.recordcount
If Form1.elements(x).checked = True Then
MsgBox "hello"
End If
Next
End Sub
Response.Write ("<form name='Form1'>")
Response.Write ("<br><table border=1 bordercolor=red width='50%' style='border-collapse:collapse'>")
Response.Write ("<br><th align='left'>Select here</th><th align='left'>Name</th><th align='left'>Comments</th>")
Do While not rsGuestbook.EOF
Response.Write ("<tr><td width='10%' align='center'>")
Response.Write ("<input type='RADIO' name='ID' value=rsGuestbook('ID_no')>")
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Name"))
Response.Write ("</td><td width='25%'>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("</td></tr>")
rsGuestbook.MoveNext
Loop
Response.Write ("</table><br><br>")
Response.Write ("<input type='submit' value='Delete' name='button'>")
Response.Write ("</form>")
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</body>
</html>


Please help me Sir,

Thanks
Deepak
Hi there,

Run through your code once again. Good luck & Take care.
Dec 11 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by DettCom | last post: by
1 post views Thread by MickG | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.