Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"constant expression is required" error when concatenating sting

Posted on 2006-06-12
1
Medium Priority
?
206 Views
Last Modified: 2011-09-20
 when i try to run this code i'm getting an error:

Dim theUser = "foo"
Dim theEvent = "foo"
   
'Specify the SQL query
            Const sql As String = "UPDATE event_claims SET deleted = 0 WHERE userID = " & g & " AND eventID = " & theEvent


when does it expect these variables to the be constants?   this was certainly not hte case in 1.1.  what's up with this?
0
Comment
Question by:alisman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
vadim63 earned 2000 total points
ID: 16890689
You can't use a constant and assign it the value of a non constant expression. Change it to

Dim sql As String = "UPDATE event_claims SET deleted = 0 WHERE userID = " & g & " AND eventID = " & theEvent
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question