I am sending an url to an email by buton click. When the email user is clicking the url he want to face login cardinals. I need to do the job without login cardinals.
Public Function SendMail(ByVal RuequestByEmpId As String, ByVal RuequestToEmpName As String, ByVal RuequestToEmpEmail As String) As Integer
Dim credential As New System.Net.NetworkCredential("joycseuiu#gmail.com", "something")
Dim msg As New System.Net.Mail.MailMessage()
Dim msgSubject As String = String.Empty
Dim strHeading As String = String.Empty
Dim EmployeeID As String = String.Empty
Dim Name As String = String.Empty
Dim Designation As String = String.Empty
Dim Email As String = String.Empty
Dim Department As String = String.Empty
Dim LeaveTYpe As String = String.Empty
Dim Reason As String = String.Empty
Dim LeaveAppID As String = String.Empty
Dim LeaveTo As String = String.Empty
Dim LeaveFrom As String = String.Empty
Dim Status As String = String.Empty
Dim i As Integer = 0
dsEmployeeInfoWithLeaveManagement.SelectParameters("EmployeeID").DefaultValue = RuequestByEmpId
dsEmployeeInfoWithLeaveManagement.DataBind()
dataview = dsEmployeeInfoWithLeaveManagement.Select(System.Web.UI.DataSourceSelectArguments.Empty)
Try
EmployeeID = dataview.Item(0).Row.Item("EmployeeID").ToString()
Name = dataview.Item(0).Row.Item("Name").ToString()
Designation = dataview.Item(0).Row.Item("Designation").ToString()
Department = dataview.Item(0).Row.Item("Department").ToString()
Email = dataview.Item(0).Row.Item("Email").ToString()
LeaveTYpe = dataview.Item(0).Row.Item("LeaveTYpe").ToString()
Reason = dataview.Item(0).Row.Item("Reason").ToString()
LeaveAppID = dataview.Item(0).Row.Item("LeaveAppID").ToString()
LeaveTo = dataview.Item(0).Row.Item("LeaveTo").ToString()
LeaveFrom = dataview.Item(0).Row.Item("LeaveFrom").ToString()
Status = dataview.Item(0).Row.Item("Status").ToString()
Catch ex As Exception
End Try
Dim SenderEmpName As String = "Joy Acharya"
Dim SenderEmpEmail As String = "joycseuiu#gmail.com"
msg.From = New System.Net.Mail.MailAddress(Email, Name)
msg.[To].Add(New System.Net.Mail.MailAddress(RuequestToEmpEmail, RuequestToEmpName))
Dim appSettings = ConfigurationManager.AppSettings
Dim result As String = appSettings("mailSender")
Dim strBody As New StringBuilder()
strBody.Append("<div>" & vbCr & vbLf & "<table>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & "<td>")
msg.Subject = "Leave Application Approve"
strBody.Append("A request for leave has been submitted for your approval.")
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Request By:</span>")
strBody.Append(Name)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>ID:</span>")
strBody.Append(EmployeeID)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Designation:</span>")
strBody.Append(Designation)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Department:</span>")
strBody.Append(Department)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Leave Type:</span>")
strBody.Append(LeaveTYpe)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Purpose:</span>")
strBody.Append(Reason)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Leave To:</span>")
strBody.Append(LeaveTo)
strBody.Append("</td>" & vbCr & vbLf & "</tr>" & vbCr & vbLf & "<tr>" & vbCr & vbLf & " <td>" & vbCr & vbLf & "<span>Leave From:</span>")
strBody.Append(LeaveFrom)
strBody.Append("</td></tr>")
strBody.Append("</table>")
strBody.Append("<br />")
strBody.Append("<table>")
strBody.Append("<tr>")
strBody.Append("<td>")
strBody.Append(" " + "<b>Approve</b>" + "")
strBody.Append("</td>")
strBody.Append("<td>")
strBody.Append(" " + "<b>Reject</b>" + "")
strBody.Append("</td>")
strBody.Append("</tr>")
strBody.Append("<table>")
strBody.Append("</div>" & vbCr & vbLf & " <div>" & vbCr & vbLf & " Thank you" & vbCr & vbLf & " <br />")
strBody.Append("=======================================================================================")
strBody.Append("</div>")
msg.Body = strBody.ToString()
msg.IsBodyHtml = True
msg.Priority = System.Net.Mail.MailPriority.High
msg.Priority = System.Net.Mail.MailPriority.High
Dim c As New SmtpClient()
'----------------------------------
'Create the SMTP Client
c.Host = "smtp.gmail.com"
c.Credentials = credential
c.Port = 587
c.EnableSsl = True
Try
c.Send(msg)
Catch ex As Exception
End Try
Return i
End Function
When the email user clicking the Approve link, he has to face the
login cardinals.
I want that, email user will just click the link and he/she will be enable
to redirect the page.
How could i do that.
And thanks in advance.
Set RsItem = Conn.Execute("EXEC E_UpdateDevBehaviourSmalls #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID")& " ,#cCompID=" & cCompetenceid & " ,#reason=" &reason & " ,#comptype=" & comptype &",#GID=" & GID & " ,#Behaviour='" & MakeSendable(Behaviour) & "' ,#Deadline='" & deadlinedatetime & "' ,#DevBehaviour='" & MakeSendable(DevBehaviour) & "' ,#Why='" & MakeSendable(Why) & "' ,#ExtraNote='" & MakeSendable(ExtraNote) & "'")
if GID = 0 then
if not RsItem.eof then
GID = RsItem.fields(0).value
if reason = 0 then
'add dummy devbehaviour detail
Set RsItem =Conn.Execute("EXEC E_UpdateDevBehaviourDetail #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & GID & " ,#DID=0 ,#TextField1='dummy' ,#educ= 0 ,#TextField2='dummy' ,#TextField3='dummy' ,#TextField4='dummy'")
end if
end if
end if
When I try to execute the code above (full code below) I got the following error:
(It gets stuck at the following part: if not RsItem.fields(0).value)
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
Can anyone help me with this error?
<%
Dim DID
Dim GID
Dim cCompetenceid
Dim Behaviour
Dim Deadline
Dim DevBehaviour
Dim Why
Dim ExtraNote
MakeConn
Session("OnlinePageID") = 106
InsertLogItem "S:12"
If Session("EUserType")=1 Then
If UCase(Request("Action"))="SAVEDETAIL" Then
If not Request("DID")="" Then
DID = Request("DID")
Else
DID = 0
End If
Conn.Execute("EXEC E_UpdateDevBehaviourDetail #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & Request("GID") & " ,#DID=" & DID & " ,#TextField1='" & MakeSendable(Request("TextField1")) & "' ,#TextField2='" & MakeSendable(Request("TextField2")) & "' ,#TextField3='" & MakeSendable(Request("TextField3")) & "' ,#TextField4='" & MakeSendable(Request("TextField4")) & "'")
Conn.Execute("EXEC E_SignIDP #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#SignStatus=0")
End If
End If
'response.write Session("EUserType") & "<br>"
If Session("EUserType")=1 Then
Select Case UCase(Request("Action"))
Case "EDIT"
If not Request("GID")="" Then
'response.write "EXEC E_GetDevBehavior #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & Request("GID") & "<br>"
Set RsItem = Conn.Execute("EXEC E_GetDevBehavior #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & Request("GID"))
If not RsItem.EOF Then
Behaviour = Replace (RsItem("Behaviour"),"''","'")
Deadline = RsItem("Deadline")
DevBehaviour = Replace (RsItem("DevBehaviour"),"''","'")
Why = Replace (RsItem("Why"),"''","'")
ExtraNote = Replace (RsItem("ExtraNote"),"''","'")
Else
Response.End
End If
'RsItem.close
'Set RsItem = nothing
Else
End If
Case "SAVE"
If not Request("GID")="" Then
Set RsItem = Conn.Execute("EXEC E_GetDevBehavior #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & Request("GID"))
If not RsItem.EOF Then
Behaviour = Replace (RsItem("Behaviour"),"''","'")
Deadline = RsItem("Deadline")
DevBehaviour = Replace (RsItem("DevBehaviour"),"''","'")
Why = Replace (RsItem("Why"),"''","'")
ExtraNote = Replace (RsItem("ExtraNote"),"''","'")
Else
Response.End
End If
'RsItem.close
'Set RsItem = nothing
end if
dag = Day(Now())
maand = Month(Now())
jaar = Year(Now())
uur = Hour(Time)
minuten = Minute(Time)
seconden = Second(Time)
if len(dag)< 2 then dag ="0" & dag
if len(maand) < 2 then maand ="0" & maand
if len(uur) < 2 then uur ="0" & uur
if len(minuten) < 2 then minuten ="0" & minuten
if len(seconden) < 2 then seconden ="0" & seconden
datum= jaar & "-" & maand & "-" & dag
tijd = uur & ":" & minuten& ":" & seconden
datumtijd = datum & " " & tijd
Conn.Execute("EXEC E_UpdatePOPStartDate #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID"))
Conn.Execute("EXEC E_UpdateStartDate #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#StartDate='" & datumtijd & "'")
If not Request("GID")="" Then
GID = Request("GID")
newcomp = false
Else
GID = 0
Deadline = CDate(FormatDate("31/12/"&year(now)))
newcomp = true
End If
'response.write Request("cCompetenceid") &"<br>"
if not Request("cCompetenceid") = "" then
cCompetenceid = Request("cCompetenceid")
else
cCompetenceid = 0
end if
if not Request("reason") = "" then
reason = Request("reason")
else
reason = 0
end if
if not Request("comptype") = "" then
comptype = Request("comptype")
else
comptype = 1
end if
Select Case (Request("COMPID"))
Case 1460
Behaviour = Request("Behaviour")
Case 1461
Deadline = Request("DeadlineDay") & "-" & Request("DeadlineMonth") & "-" & Request("DeadlineYear")
Deadline = CDate(FormatDate(Deadline))
Case 1462
DevBehaviour = Request("DevBehaviour")
Case 1463
Why = Request("Why")
Case 1464
ExtraNote = Request("ExtraNote")
End Select
deadlinedate = CDate(Deadline)
deadlineyear = year(deadlinedate)
deadlinemonth = month(deadlinedate)
deadlineday = day(deadlinedate)
deadlinedatetime = deadlineyear & "-" & deadlinemonth & "-" & deadlineday & " 00:00:00"
'response.write "EXEC E_UpdateDevBehaviourSmalls #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID")& " ,#cCompID=" & cCompetenceid & " ,#reason=" &reason & " ,#comptype=" & comptype &",#GID=" & GID & " ,#Behaviour='" & MakeSendable(Behaviour) & "' ,#Deadline='" & deadlinedatetime & "' ,#DevBehaviour='" & MakeSendable(DevBehaviour) & "' ,#Why='" & MakeSendable(Why) & "' ,#ExtraNote='" & MakeSendable(ExtraNote) & "'"
'response.end
Set RsItem = Conn.Execute("EXEC E_UpdateDevBehaviourSmalls #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID")& " ,#cCompID=" & cCompetenceid & " ,#reason=" &reason & " ,#comptype=" & comptype &",#GID=" & GID & " ,#Behaviour='" & MakeSendable(Behaviour) & "' ,#Deadline='" & deadlinedatetime & "' ,#DevBehaviour='" & MakeSendable(DevBehaviour) & "' ,#Why='" & MakeSendable(Why) & "' ,#ExtraNote='" & MakeSendable(ExtraNote) & "'")
if GID = 0 then
if not RsItem.eof then
GID = RsItem.fields(0).value
if reason = 0 then
' add dummy devbehaviour detail
Set RsItem =Conn.Execute("EXEC E_UpdateDevBehaviourDetail #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#GID=" & GID & " ,#DID=0 ,#TextField1='dummy' ,#educ= 0 ,#TextField2='dummy' ,#TextField3='dummy' ,#TextField4='dummy'")
end if
end if
end if
'RsItem.close
'Set RsItem = nothing
Conn.Execute("EXEC E_SignIDP #ClientID=" & Session("ClientID") & " ,#UserID=" & Session("EUserID") & " ,#SignStatus=0")
if newcomp = true then
tempstr = "../popoverview.asp"
ClientScript("parent.location.href = '../bottomframe.asp?GID=" & GID & "&" & SetID &"&ViewID=4'" )
else
response.write " in"
tempstr = "compoverview.asp?Action=Edit&GID="&GID
response.redirect tempstr
' ClientScript("location.href =" & tempstr)
end if
End Select
End If
conn.close
set conn= nothing
%>
Stored procedure:
USE [Q]
GO
/****** Object: StoredProcedure [dbo].[E_UpdateDevBehaviourSmalls] Script Date: 17/10/2013 15:05:53 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[E_UpdateDevBehaviourSmalls]
(#ClientID int,
#UserID int,
#cCompID int,
#reason int,
#comptype int,
#GID int,
#Behaviour varchar(250),
#Deadline datetime,
#DevBehaviour text,
#Why text,
#ExtraNote text)
AS
If (#GID = 0)
BEGIN
INSERT INTO DevBehaviour(ClientID,UserID,Behaviour,Deadline,DevBehaviour,Why,ExtraNote,cCompId,reason,comptype)
VALUES(#ClientID,#UserID,#Behaviour,#Deadline,#DevBehaviour,#Why,#ExtraNote, #cCompID,#reason,#comptype)
SELECT ##identity
END
Else
BEGIN
UPDATE DevBehaviour
SET Behaviour=#Behaviour, Deadline=#Deadline, DevBehaviour=#DevBehaviour, Why=#Why, ExtraNote=#ExtraNote, cCompId = #cCompID, reason = #reason, comptype = #comptype
WHERE (ClientID = #ClientID) AND (UserID = #UserID) AND (GID = #GID)
END
I was able to reproduce your problem. Please try the stored proc below (using nocount)
USE [Q]
GO
/****** Object: StoredProcedure [dbo].[E_UpdateDevBehaviourSmalls] Script Date: 17/10/2013 15:05:53 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[E_UpdateDevBehaviourSmalls]
(#ClientID int,
#UserID int,
#cCompID int,
#reason int,
#comptype int,
#GID int,
#Behaviour varchar(250),
#Deadline datetime,
#DevBehaviour text,
#Why text,
#ExtraNote text)
AS
set nocount on
If (#GID = 0)
BEGIN
INSERT INTO DevBehaviour(ClientID,UserID,Behaviour,Deadline,DevBehaviour,Why,ExtraNote,cCompId,reason,comptype)
VALUES(#ClientID,#UserID,#Behaviour,#Deadline,#DevBehaviour,#Why,#ExtraNote, #cCompID,#reason,#comptype)
SELECT ##identity
END
Else
BEGIN
UPDATE DevBehaviour
SET Behaviour=#Behaviour, Deadline=#Deadline, DevBehaviour=#DevBehaviour, Why=#Why, ExtraNote=#ExtraNote, cCompId = #cCompID, reason = #reason, comptype = #comptype
WHERE (ClientID = #ClientID) AND (UserID = #UserID) AND (GID = #GID)
END
set nocount off
I'm new to VbScript. I have to make a form for uploading a file and sending to specified email as attachment.
For uploading I used this script http://www.freeaspupload.net/freeaspupload/viewsource.asp
Now my application saves file to server.
The second part looks like this:
<% OPTION EXPLICIT
If Request.Cookies("QuoteRequest") = "Quote" THEN
Dim fileName
Dim strMsg
Dim mail
Dim strSubject
Dim strFrom
Dim strReply
Dim strChoice
Dim AddCheck
Dim MyCheckDate
Dim strMailBlindCopy
Dim smtpserver
Dim youremail
Dim public_mailer
Dim public_password
smtpserver = ""
youremail = ""
public_mailer = ""
public_password = ""
AddCheck = Request.Form("Str_xxrand234Myanswer")
'Use this next line if you want a blind copy send for your records
'strMailBlindCopy = "info#ciupac.com"
'IF AddCheck = "" or NULL THEN
IF len(AddCheck)>2 OR len(AddCheck)<1 OR IsNumeric(AddCheck)=FALSE THEN
response.write "<h2>Sorry an error has occurred, please click here to return to the form</h2>" & AddCheck
Else
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = public_mailer
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = public_password
ObjSendMail.Configuration.Fields.Update
strFrom = "Quote Request Form"
strReply = Request.Form("txtemail")
strSubject = "Quote Request Form"
strMsg = strMsg & "<b>Your Name:</b> " & Request.Form("txtname") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Your Company Name:</b> " & Request.Form("txtcompany") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Your Order Number:</b> " & Request.Form("txtyourorder") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Our Order Number:</b> " & Request.Form("txtourorder") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Destination Postal Code:</b> " & Request.Form("txtpostal") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Order Date:</b> " & Request.Form("txtdate") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Your E-mail Address:</b> " & Request.Form("txtemail") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Telephone #:</b> " & Request.Form("txtphone") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Comments:</b> " & Request.Form("txtcomments") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Market Served:</b> " & Request.Form("option1") & ", " & Request.Form("option2") & ", " & Request.Form("option3") & ", " & Request.Form("option4") & ", " & Request.Form("option5") & ", " & Request.Form("option6") & ", " & Request.Form("option7") & ", " & Request.Form("option8") & ", " & Request.Form("option9") & ", " & Request.Form("option10") & ", " & Request.Form("option11") & ", " & Request.Form("option12") & ", " & Request.Form("option13") & ", " & Request.Form("option14") & vbCrLF & vbCrLF & "<BR>" & "<BR>"
strMsg = strMsg & "<b>Topic of Interest:</b> " & Request.Form("option15") & ", " & Request.Form("option16") & ", " & Request.Form("option17") & ", " & Request.Form("option18") & ", " & Request.Form("option19") & ", " & Request.Form("option20") & ", " & Request.Form("option21") & ", " & Request.Form("option22") & ", " & Request.Form("option23") & ", " & Request.Form("option24") & ", " & Request.Form("option25") & ", " & Request.Form("option26") & ", " & Request.Form("option27") & ", " & Request.Form("option28") & ", " & Request.Form("option29") & ", " & Request.Form("option30") & ", " & Request.Form("option31") & ", " & Request.Form("option32") & vbCrLF & vbCrLF
fileName = Request.Form("file")
Dim strMailTo
strMailTo =""
ObjSendMail.To = strMailTo
ObjSendMail.Subject = strSubject
ObjSendMail.From = strReply
ObjSendMail.HTMLBody = strMsg
If Len(fileName)Then
ObjSendMail.AddAttachment "C:\attachments\" & fileName
End If
ObjSendMail.Send
Set ObjSendMail = Nothing
Response.Redirect("thank-you.asp")
END IF
ELSE
Dim txtname
Response.Write "ERROR <P>"
fname=Request.Cookies("QuoteRequest")
response.write("QuoteRequest=" & txtname)
END IF
%>
These two scripts work well independently, but when I try to include the email send part to upload the Cannot use Request.Form collection after calling BinaryRead error appears.
How do I need to call the email sender?
Due to the special ENCTYPE="multipart/form-data" attribute of your form, you cannot use the Reqest.Form collection. Use Upload.Form instead, but only after you call Upload.Save (SaveVirtual, SaveToMemory).
I need to create the date and time of extraction in the following format.
extractDate='2011-10-18T12:00:00.000000'
What is the best way, using vbscript / asp3 to do this? I was just thinking of hard-coding the end portion of .000000 since this is not a horse race LOL
Thanks.
So Far I am starting with something like;
xmlDateTime = FormatDateTime(Now(),0)
xmlDateTime = Replace(xmlDateTime, " PM", "")
xmlDateTime = Replace(xmlDateTime, " AM", "")
Response.Write xmlDateTime & "<br>"
UPDATE:
My potential solution:
xmlDateTime = FormatDateTime(Now(),0)
xmlDateTime = Replace(xmlDateTime, " PM", "")
xmlDateTime = Replace(xmlDateTime, " AM", "")
Response.Write xmlDateTime & "<br>"
splitDateTime = Split(xmlDateTime, " ")
xmlDate = splitDateTime(0)
xmlTime = splitDateTime(1)
strYear = DatePart("yyyy",xmlDate)
strMonth = DatePart("m",xmlDate)
strDay = DatePart("d",xmlDate)
Response.Write strYear & "<br>"
Response.Write strMonth & "<br>"
Response.Write strDay & "<br>"
xmlDateTime = strYear & "-" & strMonth & "-" & strDay & "T" & xmlTime & ".000000"
Response.write xmlDateTime & "<br>"
You need to construct the date string manually.
Function dd(str)
dd = Right("0" & str, 2)
End Function
d = Now
extractDate = Year(d) & "-" & dd(Month(d)) & "-" & dd(Day(d)) & "T" _
& dd(Hour(d)) & ":" & dd(Minute(d)) & ":" & dd(Second(d)) & ".000000"
The code below is how to show/split 2 rows in a table.
But how do I get it to show/split it to 4 rows and not only two ???
dim bCloseRow
bCloseRow = True
Do while not objTrucks.eof
If bCloseRow Then response.write "<tr>"
bCloseRow = Not bCloseRow
response.write "<td><input type=checkbox name=dno value=" & objTrucks("TRUCK_NO") & objTrucks("TRUCK_NO") & ">" & objTrucks("TRUCK_NO") & "</td>"
If bCloseRow Then response.write "</tr>"
objTrucks.movenext
loop
Thanks for any help.
If there are more rows then four in the recordset you have to make a row more. And if there is less then four you have to insert some empty td tags.
Hope this helps
const iCols=4
dim iCount:iCount=0
if not objTrucks.eof then
response.write "<table>"
Do while not objTrucks.eof
if iCount=0 then response.write "<tr>"
response.write "<td><input type=checkbox name=dno value=" & objTrucks("TRUCK_NO") & objTrucks("TRUCK_NO") & ">" & objTrucks("TRUCK_NO") & "</td>"
objTrucks.movenext
iCount = iCount + 1
if iCount=iCols then
response.write "</tr>"
iCount=0
end if
loop
if iCount>0 then
for i = iCount to iCols-1
response.write "<td></td>"
next
response.write "</tr>"
end if
response.write "</table>"
end if
I would do this using a counter instead of a Boolean flag:
Const numCols = 4
Dim counter
counter = 0
Do While Not objTrucks.EOF
If counter Mod numCols = 0 Then
Response.Write "<tr>"
End If
counter = counter + 1
Response.Write "<td><input type=checkbox name=dno value=" & objTrucks("TRUCK_NO") & objTrucks("TRUCK_NO") & ">" & objTrucks("TRUCK_NO") & "</td>"
If counter Mod numCols = 0 Then
Response.Write "</tr>"
End If
objTrucks.MoveNext
Loop