Click here to Skip to main content
16,005,241 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Export to excel / word application Pin
Sarvesvara (BVKS) Dasa31-Mar-04 17:36
Sarvesvara (BVKS) Dasa31-Mar-04 17:36 
Questionhow do i add my htc to vml ? Pin
nakey_yang29-Mar-04 16:51
nakey_yang29-Mar-04 16:51 
AnswerRe: how do i add my htc to vml ? Pin
nakey_yang30-Mar-04 14:53
nakey_yang30-Mar-04 14:53 
GeneralPHP Blowfish Pin
alex.barylski29-Mar-04 12:12
alex.barylski29-Mar-04 12:12 
GeneralRe: PHP Blowfish Pin
l a u r e n29-Mar-04 12:51
l a u r e n29-Mar-04 12:51 
GeneralRe: PHP Blowfish Pin
alex.barylski1-Apr-04 18:21
alex.barylski1-Apr-04 18:21 
Generalhtml email... Pin
l a u r e n29-Mar-04 9:56
l a u r e n29-Mar-04 9:56 
GeneralUpdating a record using Checkboxes - Help !!! Pin
Panther129-Mar-04 9:48
Panther129-Mar-04 9:48 
This is my first update record and I'm trying to get ideals on a great way to do it. I am basically using a checkbox to select a record to update. I was able to borrow some code "The Code Project (ASP Help Board, similiar to ASPFREE)". A nice guy name Torsten Mauz left the link. So I incorporated it into my code, but I can't get it to work. Can someone give it a look...and spread the wealth... the Code is below.




<% Language ="VBscript" %>


<%

Dim CnDB
Dim rsData
Dim strConnect
Dim strSQL
Dim srchLastName

%>


<title> Resource Pool Database Record Update







Resource Employee Pool - Update Search for:



<%
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
' ASP CODE / Opens the recorDset and AND selects all the data '
' and writes the database to the screen. '
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
srchLastName = Request.Form("strLastName")

If srchLastName <> "" Then

Set CnDB = OpenDB() 'Opens the Database
Set rsData = Server.CreateObject ("ADODB.RecordSet") 'Opens the Recorset

strSQL = "Select * From ****** Where LastName = '" & srchLastName & "'" 'Selects all the data in the database
Set rsData = CnDB.Execute(strSQL) 'Executes the command to retrieve the database

'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''
' This setsup the table for writing the files to the database '
' '
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''


If Not (rsData.EOF) Then
%>



















<%

Dim rsEmpId
Dim rsFirstName
Dim rsLastName
Dim rsWorkDay
Dim rsCUnion
Dim rsBranch
Dim rsDept
Dim rsTimeIn
Dim rsTimeOut
Dim rsLunchOut
Dim rsLunchIn
Dim rsTotalHours
Dim rsAuthSig

Do Until rsData.EOF

'rsEmpId = rsData("EmpId")
rsLastName = rsData("LastName")
rsFirstName = rsData("Firstname")
rsWorkDay = rsData("Workday")
rsCUnion = rsData("CreditUnion")
rsBranch = rsData("Branch")
rsDept = rsData("Dept")
rsTimeIn = rsData("TimeIn")
rsTimeOut = rsData("TimeOut")
rsLunchOut = rsData("LunchOut")
rsLunchIn = rsData("LunchIn")
rsTotalHours = rsData("THours")
rsMetricHours = rsData("MHours")
'rsAuthSig = rsData("AuthSig")
Response.Write ""
'Response.Write "
UpdateLast NameFirst NameWork DayCredit UnionBranchDepartmentTime InTime OutLunch OutLunch InTotal HoursMetric HoursAuthorized By
  "


'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''
' Borrowed Code '
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''

dim iNum 'the number of checkboxes to generate
dim strAll 'a comma delinated list of all the values
dim i 'a loop counter
dim arrAll 'an array which will hold all of the values
dim arrVals 'an array to hold all checked values
dim arrInactive() 'an array to hold all unchecked values
dim bThere 'a boolean match variable
dim IDX 'an index variable
'dim strSql 'the resulting SQL string
dim z 'a loop counter

iNum = Request.QueryString ("numBoxes")

if iNum = "" then
iNum = 10
end if

if Request.Form = "" then

strAll = ""
%>



<%
'**********************
'this would be your recordset loop
'basically replace i with the ID of the record.
for i = 1 to iNum
Do
%>
<%
''''''''''''''''''''''''''
'' My Code '
''''''''''''''''''''''''''
Response.Write "" & VbCrlf
Response.Write "" & VbCrlf
Response.Write "" & VbCrlf
Response.Write "" & VbCrlf
Response.Write "" & VbCrlf
Response.Write "" & VbCrlf
Response.Write "" & VbCrLf
Response.Write "" & VbCrLf
Response.Write "" & VbCrLf
Response.Write "" & VbCrLf
Response.Write "" & VbCrLf
Response.Write "" & VbCrLf
'Response.Write "" & VbCrLf
Response.Write ""
rsData.MoveNext
Loop

rsData.Close
CloseDB CnDB
End If

'''''''''''''''''''''''''''''''''
' Borrowed Code Continues '
'''''''''''''''''''''''''''''''''


%>
<%
'append the id to strAll
strAll = strAll & i & ","
next
%>
<%=i%>" & rsLastName & "" & rsFirstName & "" & rsWorkDay & "" & rsCUnion & "" & rsBranch & "" & rsDept & "" & rsTimeIn & "" & rsTimeOut & "" & rsLunchOut & "" & rsLunchIn & "" & rsTotalHours & "" & rsMetricHours & "" & rsAuthSig & "

<%
'trim off the trailing ","
strAll = left(strAll, (len(strAll) -1))
%>


<%
else
'get the array with all of the checkbox id's
arrAll = split(Request.Form ("allBoxes"), ",")

'get the array with the id's that were ticked
arrVals = split(Request.Form ("chkBox"), ",")

strSql = ""
strSql = strSql & "UPDATE aTable SET active = 1 WHERE "

'loop through the checkboxes which were ticked
for i = 0 to ubound(arrVals)
if i = 0 then
strSql = strSql & "id = "& arrVals(i)
else
'only add the " AND " if this is not the first value
strSql = strSql & " AND id = "& arrVals(i)
end if
next

Response.Write strSql & "
"

'dimension the array to the size we need
redim arrInActive(ubound(arrAll) - ubound(arrVals))

'set our indexer variable
IDX = 0

'loop through all the checkbox values
for i = 0 to ubound(arrAll)
'a boolean value to check if we match or not
bThere = false
'loop through the values which were submitted
for z = 0 to ubound(arrVals)
'if it is found then set the boolean to true
'this is so we don't add it to the new array
if trim(arrVals(z)) = trim(arrAll(i)) then
bThere = true
end if
next
'if it wasn't in the submitted array (i.e. it wasn't checked)
if bThere = false then
'add the value to the new array
arrInactive(IDX) = arrAll(i)
'increment our indexer
IDX = IDX + 1
end if
next

strSql = ""
strSql = strSql & "UPDATE aTable SET active = 0 WHERE "
'loop through the array which holds the values that were NOT ticked
for i = 0 to ubound(arrInactive)
if arrInactive(i) <> "" then
if i = 0 then
strSql = strSql & "id = "& arrInactive(i)
else
'only add the " ADD " if this is not the first variable
strSql = strSql & " AND id = "& arrInactive(i)
end if
end if
next

Response.Write strSql
end if
%>

{ alert("A LastName Is Required to Do a Search");
}

Click Here to Search again
<%

End If
Loop
End If

%>




Thanks:

Vision: The ability to see the invisible....

GeneralNo Default Website Folder Pin
Anonymous29-Mar-04 4:37
Anonymous29-Mar-04 4:37 
GeneralRe: No Default Website Folder Pin
Sarvesvara (BVKS) Dasa29-Mar-04 17:36
Sarvesvara (BVKS) Dasa29-Mar-04 17:36 
General.NET based HTML to PDF converter Pin
troels_sorensen29-Mar-04 3:50
troels_sorensen29-Mar-04 3:50 
GeneralRe: .NET based HTML to PDF converter Pin
OMalleyW7-Apr-04 11:35
OMalleyW7-Apr-04 11:35 
GeneralONLINE PAYMENT DATABASE Pin
Brendan Vogt28-Mar-04 19:40
Brendan Vogt28-Mar-04 19:40 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Sarvesvara (BVKS) Dasa28-Mar-04 19:45
Sarvesvara (BVKS) Dasa28-Mar-04 19:45 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Brendan Vogt28-Mar-04 19:52
Brendan Vogt28-Mar-04 19:52 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Sarvesvara (BVKS) Dasa28-Mar-04 20:09
Sarvesvara (BVKS) Dasa28-Mar-04 20:09 
GeneralRe: ONLINE PAYMENT DATABASE Pin
l a u r e n29-Mar-04 10:00
l a u r e n29-Mar-04 10:00 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Sarvesvara (BVKS) Dasa29-Mar-04 17:30
Sarvesvara (BVKS) Dasa29-Mar-04 17:30 
GeneralRe: ONLINE PAYMENT DATABASE Pin
l a u r e n29-Mar-04 17:39
l a u r e n29-Mar-04 17:39 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Colin Angus Mackay29-Mar-04 22:36
Colin Angus Mackay29-Mar-04 22:36 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Sarvesvara (BVKS) Dasa30-Mar-04 0:27
Sarvesvara (BVKS) Dasa30-Mar-04 0:27 
GeneralRe: ONLINE PAYMENT DATABASE Pin
Colin Angus Mackay29-Mar-04 4:40
Colin Angus Mackay29-Mar-04 4:40 
GeneralRe: ONLINE PAYMENT DATABASE Pin
l a u r e n29-Mar-04 9:59
l a u r e n29-Mar-04 9:59 
Generalweb icons.. Pin
jeevan2228-Mar-04 15:41
jeevan2228-Mar-04 15:41 
GeneralRe: web icons.. Pin
Mike Ellison28-Mar-04 18:14
Mike Ellison28-Mar-04 18:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.