Hakan Subaşı
Hakan Subaşı

Reputation: 61

How to use session definition in SQL ASP?

I have a session definition on login page named Session("user") and I want to use this session in my sql such as

Set insertrec=db.Execute("insert into prgcontrol (vercheck) values ('"&=Session("user")&"' )" )

But I could not do anything with this code.

Can anyone help me?

Upvotes: 0

Views: 67

Answers (1)

YK1
YK1

Reputation: 7612

Firstly, this is very bad way of talking to database. Never use string concatenation. Learn about parameterized queries. See sample here.

But anyway, from your code it looks like you have an extra = character before Session

Set insertrec=db.Execute("insert into prgcontrol (vercheck) values ('" & Session("user") & "')" )

Upvotes: 2

Related Questions