i want to use following code to insert data into database:
-------------------------------------
<script language="vbscript">
newusername=<%=session("newusername")%>
</script>
<%
if newusername<>"" then
sqlstring=" INSERT INTO result (username,col1,col2,col3,col4)VALUES(' '"&newusername&"',1,2,3,4)"
Con.Execute sqlstring
end if
%>
the session variable is defined properly, and can be read by other code directly in this page,ie, if i code : document.write "my name is <%=session("newusername")%>",it can display properly.
But when I intend to insert it into databse by assigning the session variable to another variable, it doesn't work. Could you tell me why and how to fix it? thanks a lot.
-------------------------------------
<script language="vbscript">
newusername=<%=session("newusername")%>
</script>
<%
if newusername<>"" then
sqlstring=" INSERT INTO result (username,col1,col2,col3,col4)VALUES(' '"&newusername&"',1,2,3,4)"
Con.Execute sqlstring
end if
%>
the session variable is defined properly, and can be read by other code directly in this page,ie, if i code : document.write "my name is <%=session("newusername")%>",it can display properly.
But when I intend to insert it into databse by assigning the session variable to another variable, it doesn't work. Could you tell me why and how to fix it? thanks a lot.