Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 ASP variable to MS SQL database?!?

Author  Topic 

undertaker
Starting Member

1 Post

Posted - 2009-04-03 : 02:38:40
Im trying to insert data to Microsoft SQL 2005 standard 32bit database by SQL script from ASP page. Problem is that it inserts the code in database instead of variable value. See below:

ASP page:
session("wreso") = "<script>document.write(screen.width);</script>"
session("hreso") = "<script>document.write(screen.height);</script>"

SQL="Insert into Reso (ip, wreso, hreso) values ('" & session("ip") & "','" & session("wreso2") & "','" & session("hreso2") & "')"
oConnection.execute(SQL)

The code above inserts ""<script>document.write(screen.width);</script>"" to database cell instead the screen width (like 1280) which I intented. But when I print out that variable value to web page the result is screen width. So the variable includes the right value but somehow in database the result is totally wrong.

gvphubli
Yak Posting Veteran

54 Posts

Posted - 2009-04-03 : 12:37:00
This is a ASP coding issue, pls. post it in appropriate forums.

however, the solution to your issue is get the screen.width into an variable and pass it on to SQL Statement. Looking at above ASP Code looks like you are embeding a java script which will only get executed after the ASP code is rendered to the client side.



TechnologyYogi
http://gvphubli.blogspot.com/
Go to Top of Page
   

- Advertisement -