Submit button Question

R

Rich Cooper

hi, i have a small problme hopfeully there is a simple sollution. I have a
submit button on my page and when a user clicks on it i want them to be able
to change a value is the table doc_profile from Y to N. Here is what i have
so far but it gives me an error in my code. can you write sql code in
vbscript fuctions?

function btnundelete_OnClick
dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
dim bFound, sPIDList, i
Cnt iCnt = 0
bFound = false s
ConnStr = session("ConnStr")
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sConnStr
oConn.CursorLocation = 3
oConn.CommandTimeout = 0
set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
set oElements = document.frmTL.elements
for Each oElement in oElements
if oElement.type= "checkbox" and oElement.checked = true then s
PIDList = sPIDList & " '" & oElement.value & "',"
iCnt = iCnt + 1
end if
next
if len(sPIDList) > 0 then
sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
end if
if iCnt > 0 then
msgbox(icnt)
msgbox(spidlist)
sSql = "update doc_profile set deleteflag = 'n' from doc_profile where pid
=" & spid
set rs = oConn.Execute(sSql)
rs.Close
else call msgbox ("Please make a selction before Undeleting a Doctor.",
vbOKOnly + vbInformation, "Target List")
end if
end function


Any help would be great
 
K

Ken Schaefer

Maybe it would help if you told us what the error actually is.

Cheers
Ken


: hi, i have a small problme hopfeully there is a simple sollution. I have
a
: submit button on my page and when a user clicks on it i want them to be
able
: to change a value is the table doc_profile from Y to N. Here is what i
have
: so far but it gives me an error in my code. can you write sql code in
: vbscript fuctions?
:
: function btnundelete_OnClick
: dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
: dim bFound, sPIDList, i
: Cnt iCnt = 0
: bFound = false s
: ConnStr = session("ConnStr")
: Set oConn = Server.CreateObject("ADODB.Connection")
: oConn.Open sConnStr
: oConn.CursorLocation = 3
: oConn.CommandTimeout = 0
: set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
: set oElements = document.frmTL.elements
: for Each oElement in oElements
: if oElement.type= "checkbox" and oElement.checked = true then s
: PIDList = sPIDList & " '" & oElement.value & "',"
: iCnt = iCnt + 1
: end if
: next
: if len(sPIDList) > 0 then
: sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
: end if
: if iCnt > 0 then
: msgbox(icnt)
: msgbox(spidlist)
: sSql = "update doc_profile set deleteflag = 'n' from doc_profile where pid
: =" & spid
: set rs = oConn.Execute(sSql)
: rs.Close
: else call msgbox ("Please make a selction before Undeleting a Doctor.",
: vbOKOnly + vbInformation, "Target List")
: end if
: end function
:
:
: Any help would be great
:
:
 
R

Rich Cooper

the error is it won't chnage that value in my table from y to n. It says
error on page.
 
K

Ken Schaefer

You mean in the Internet Explorer status bar? That's a client-side
javascript/vbscript error. It means your client-side script is running into
a problem. If this is classic ASP, you need to submit the form back to the
server in order to have the ASP run - ASP only runs on the server (Active
*Server* Pages).

Cheers
Ken

: the error is it won't chnage that value in my table from y to n. It says
: error on page.
: : > Maybe it would help if you told us what the error actually is.
: >
: > Cheers
: > Ken
: >
: >
: > : > : hi, i have a small problme hopfeully there is a simple sollution. I
: have
: > a
: > : submit button on my page and when a user clicks on it i want them to
be
: > able
: > : to change a value is the table doc_profile from Y to N. Here is what
i
: > have
: > : so far but it gives me an error in my code. can you write sql code in
: > : vbscript fuctions?
: > :
: > : function btnundelete_OnClick
: > : dim oElement, oElements, oCkbox, oconn, rs, ssql, sconnstr
: > : dim bFound, sPIDList, i
: > : Cnt iCnt = 0
: > : bFound = false s
: > : ConnStr = session("ConnStr")
: > : Set oConn = Server.CreateObject("ADODB.Connection")
: > : oConn.Open sConnStr
: > : oConn.CursorLocation = 3
: > : oConn.CommandTimeout = 0
: > : set rs = Server.CreateObject("adodb.Recordset") rs.CursorLocation = 3
: > : set oElements = document.frmTL.elements
: > : for Each oElement in oElements
: > : if oElement.type= "checkbox" and oElement.checked = true then s
: > : PIDList = sPIDList & " '" & oElement.value & "',"
: > : iCnt = iCnt + 1
: > : end if
: > : next
: > : if len(sPIDList) > 0 then
: > : sPIDList = mid(sPidList, 1, len(sPidlist) - 1)
: > : end if
: > : if iCnt > 0 then
: > : msgbox(icnt)
: > : msgbox(spidlist)
: > : sSql = "update doc_profile set deleteflag = 'n' from doc_profile where
: pid
: > : =" & spid
: > : set rs = oConn.Execute(sSql)
: > : rs.Close
: > : else call msgbox ("Please make a selction before Undeleting a
Doctor.",
: > : vbOKOnly + vbInformation, "Target List")
: > : end if
: > : end function
: > :
: > :
: > : Any help would be great
: > :
: > :
: >
: >
:
:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top