Solved

"constant expression is required" error when concatenating sting

Posted on 2006-06-12
1
191 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
1 Comment
 
LVL 10

Accepted Solution

by:
vadim63 earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Word Template Mail merge with vb.net 4 59
Parallel.ForEach using SendMailAsync() detect when loop is complete 24 58
vb.net checkbox 7 41
SQL syntax in VB.net 5 30
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now