By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,028 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

session issues

100+
P: 102
[PHP]<%
If Session("username") = "" Then
Response.Redirect("/CLS/Login.asp")
End If

Dim conn
Dim connectstr
Dim db_name, db_username, db_userpassword
Dim db_server
Dim res

db_server = "localhost"
db_name = "cls1"
db_username = "root"
db_userpassword = "newpwd"

connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connectstr

'---------------------------------
dim part, fdate,desc,pic,p,p2,p3,p4,p5,p6, a,a2,a3,a4,a5,a6,suc,suc2,suc3,suc4,suc5,suc6,cc,c c2,cc3,cc4,cc5,cc6, soc,soc2,soc3,soc4,soc5,soc6


session("part")= request.form("Part")
session("fdate")= Request.form("FAdate")
session("desc")= Request.form("Desc")
session("pic")= Request.form("myFile")
session("p")= Request.form("plan1")
session("p2") = Request.form("plan2")
session("p3") = Request.form("plan3")
session("p4") = Request.form("plan4")
session("p5") = request.form("plan5")
session("p6") = Request.form("plan6")
session("a") = Request.form("actual1")
session("a2") = Request.form("actual2")
session("a3") = Request.form("actual3")
session("a4") = Request.form("actual4")
session("a5") = Request.form("actual5")
session("a6") = Request.form("actual6")
session("suc") = request.form("SuppCom")
session("suc2") = Request.form("SuppCom2")
session("suc3") = Request.form("SuppCom3")
session("suc4") = Request.form("SuppCom4")
session("suc5") = Request.form("SuppCom5")
session("suc6") = Request.form("SuppCom6")
session("cc") = Request.form("CustCom")
session("cc2") = Request.form("CustCom2")
session("cc3") = request.form("CustCom3")
session("cc4") = Request.form("CustCom4")
session("cc5") = Request.form("CustCom5")
session("cc6") = Request.form("CustCom6")
session("soc") = Request.form("SourceCom")
session("soc2") = Request.form("SourceCom2")
session("soc3") = Request.form("SourceCom3")
session("soc4") = Request.form("SourceCom4")
session("soc5") = Request.form("SourceCom5")
session("soc6") = Request.form("SourceCom6")

'-----------------------------------------------------------------
if session("part") = "" then
response.redirect("WeeklyReport.asp?res=blankPart" )
end if

dim qrycheck, rscheck
qrycheck="select PartNumber from weeklyreport where PartNumber="&session("part")&""
set rscheck = conn.execute(qrycheck)


'----------------------------------------------------------------




if not rscheck.eof then
response.redirect("WeeklyReport.asp?res=exist")

elseif session("fdate") = "" then
response.redirect("WeeklyReport.asp?res=blankDate" )

elseif session("desc") = "" then
response.redirect("WeeklyReport.asp?res=blankDesc" )

elseif session("part") = "" then
response.redirect("WeeklyReport.asp?res=blank")

elseif session("p") = "" then
response.redirect("WeeklyReport.asp?res=blankPlanD ate")

elseif session("p2") = "" then
response.redirect("WeeklyReport.asp?res=blankPlanD ate")

elseif session("p3") = "" then
response.redirect("WeeklyReport.asp?res=blankPlanD ate")

elseif session("p4") = "" then
response.redirect("WeeklyReport.asp?res=blankPlanD ate")

elseif session("p5") = "" then
response.redirect("WeeklyReport.asp?res=blankPlanD ate")




'-----------------------------------------------------------------
elseif cdate (session("p")) > cdate (session("fdate")) then
response.redirect("WeeklyReport.asp?res=dateOver")

else if cdate (session("p2")) > cdate (session("fdate")) then
response.redirect("WeeklyReport.asp?res=dateOver")

elseif cdate (session("p3")) > cdate (session("fdate")) then
response.redirect("WeeklyReport.asp?res=dateOver")

elseif cdate (session("p4")) > cdate (session("fdate")) then
response.redirect("WeeklyReport.asp?res=dateOver")

elseif cdate(session("p5")) > cdate(session("fdate")) then
response.redirect("WeeklyReport.asp?res=dateOver")



elseif cdate(session("a")) > cdate(session("p")) then
response.redirect("WeeklyReport.asp?res=ActualOver Plan")

elseif cdate(session("a2")) > cdate(session("p2")) then
response.redirect("WeeklyReport.asp?res=ActualOver Plan")

elseif cdate(session("a3")) > cdate(session("p3")) then
response.redirect("WeeklyReport.asp?res=ActualOver Plan")

elseif cdate(session("a4")) > cdate(session("p4")) then
response.redirect("WeeklyReport.asp?res=ActualOver Plan")

elseif cdate(session("a5")) > cdate(session("fdate")) then
response.redirect("WeeklyReport.asp?res=ActualOver Plan")

else


dim rsInsert, qryInsert

qryInsert = "insert into weeklyreport (PartNumber,FA_Date,Description,Image_Path,Plan1,P lan2,Plan3,Plan4,Plan5,Plan6, Actual1,Actual2,Actual3,Actual4,Actual5,Actual6,Su pp_comm,Supp_comm2,Supp_comm3, Supp_comm4,Supp_comm5,Supp_comm6, Cust_comm,Cust_comm2,Cust_comm3,Cust_comm4,Cust_co mm5,Cust_comm6, Sourcing_comm,Sourcing_comm2,Sourcing_comm3,Sourci ng_comm4,Sourcing_comm5, Sourcing_comm6)
values("&session("part")&","&session("fdate")&","& session("desc")&","&session("pic")&", "&session("p")&","&session("p2")&","&session("p3") &","&session("p4")&","&session("p5") &","&session("a")&","&session("a2")&","&session("a 3")&","&session("a4")&","&session("a5") &","&session("a6")&","&session("suc")&","&session( "suc2")&","&session("suc3")&"," &session("suc4")&","&session("suc5")&","&session(" cc")&","&session("cc2")&","
&session("cc3")&","&session("cc4")&","&session("cc 5")&","&session("cc6")&"," &session("soc")&","&session("soc2")&","&session("s oc3")&","&session("soc4")&"," &session("soc5")&","&session("soc6")&")"

set rsInsert = conn.execute(qryInsert)


session("part")= ""
session("fdate")= ""
session("desc")= ""
session("pic")= ""
session("p") = ""
session("p2") = ""
session("p3") = ""
session("p4") = ""
session("p5") = ""
session("p6") = ""
session("a ") = ""
session("a2 ") = ""
session("a3") = ""
session("a4") = ""
session("a5") = ""
session("a6") = ""
session("suc") = ""
session("suc2") = ""
session("suc3") = ""
session("suc4") = ""
session("suc5") = ""
session("suc6") = ""
session("cc") = ""
session("cc2") = ""
session("cc3") = ""
session("cc4") = ""
session("cc5") = ""
session("cc6") = ""
session("soc") = ""
session("soc2") = ""
session("soc3") = ""
session("soc4") =""
session("soc5") = ""
session("soc6") =""


response.redirect("WeeklyReport.asp?res=created")

end if
end if

%>[/PHP]
before i use session ... all data can go in to database... but after i use session .. below is the error..

[PHP]
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '06/05/2007,06/07/2007,06/11/2007,06/04/2007,06/05/2007,06/01/2007,06/01/2007,06/' at line 1

/CLS1/WeeklyReport/WeeklyReport2.asp, line 146 [/PHP]

line 146 is
[PHP]set rsInsert = conn.execute(qryInsert)[/PHP]

i declared the date as varchar(45) .. it works fine previously..pls help thanks..
Jun 27 '07 #1
Share this Question
Share on Google+
5 Replies


jhardman
Expert 2.5K+
P: 3,405
the difference has to be in qryInsert. Try the following with and without the session variables:
Expand|Select|Wrap|Line Numbers
  1. response.write "<!-- qryInsert: " & qryInsert & " -->" & vbNewLine
Does this line print exactly the same in both cases? Tell me what you get.

Jared
Jun 27 '07 #2

100+
P: 102
the difference has to be in qryInsert. Try the following with and without the session variables:
Expand|Select|Wrap|Line Numbers
  1. response.write "<!-- qryInsert: " & qryInsert & " -->" & vbNewLine
Does this line print exactly the same in both cases? Tell me what you get.

Jared
i don understand what u meant.. u meant try not to put in qryInsert??
Jun 27 '07 #3

Expert 100+
P: 303
Have you tried placing the session variables within quotes in qryInsert (line 144)?

Expand|Select|Wrap|Line Numbers
  1. qryInsert = "insert into weeklyreport (PartNumber, FA_Date, Description, Image_Path, Plan1, Plan2, Plan3, Plan4, Plan5, Plan6, Actual1, Actual2, Actual3, Actual4, Actual5, Actual6, Supp_comm, Supp_comm2, Supp_comm3, Supp_comm4, Supp_comm5, Supp_comm6, Cust_comm, Cust_comm2, Cust_comm3, Cust_comm4, Cust_comm5, Cust_comm6, Sourcing_comm, Sourcing_comm2, Sourcing_comm3, Sourcing_comm4, Sourcing_comm5, Sourcing_comm6) values("' & session("part") & "', '" & session("fdate") & "','" & session("desc") & "','" & session("pic") & "','" & session("p") & "','" & session("p2") & "','" & session("p3") & "','" & session("p4") & "','" & session("p5") & "','" & session("a") & "','" & session("a2") & "','" & session("a3") & "','" & session("a4") & "','" & session("a5") & "','" & session("a6") & "','" & session("suc") & "','" & session("suc2") & "','" & session("suc3") & "','" & session("suc4") & "','" & session("suc5") & "','" & session("cc") & "','" & session("cc2") & "','" & session("cc3") & "','" & session("cc4") & "','" & session("cc5") & "','" & session("cc6") & "','" & session("soc") & "','" & session("soc2") & "','" & session("soc3") & "','" & session("soc4") & "','" & session("soc5") & "','" & session("soc6") & "')"
Jun 27 '07 #4

100+
P: 102
[quote=improvcornartist]Have you tried placing the session variables within quotes in qryInsert (line 144)?

thanks for reply..!!! .. but what do u meant by placing the session variable within quotes in qryInsert??? wht is the quotes for session???
Jun 27 '07 #5

Expert 100+
P: 303
thanks for reply..!!! .. but what do u meant by placing the session variable within quotes in qryInsert??? wht is the quotes for session???
I mean using single quotes in your qryInsert, like I did in the code I posted in my other reply.
Jun 27 '07 #6

Post your reply

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