andash
Posts: 18
|
Posted: 01/10/2008, 12:09 AM |
|
Can anyone shed some light on this problem for me?
VB.net, CCS 3.99, .net2.0, IIS, MS-SQL 2005:
I have a registration page that creates a GUID using a Variable System.Guid.NewGuid().ToString() that works great. It inserts this in to the guid field in the users table and sends the email with that as part of the activate link in the email.
Next I have built a page that this link refers to where I have added a "before show" action that should update the user status field where the Table Users.Guid = the Guid in the URL( a declared variable). Simple!.
However I'm not sure how to format the Guid Variablename correctly to include it in the SQL update statement. It needs to be contained by ' ' as it is a text feld.
Current code is:
Dim Request As HttpRequest = HttpContext.Current.Request
Dim NewDao As DataAccessObject = Settings.SQLServerDataAccessObject
Dim Sql As String = "UPDATE users SET Status = 'Y' WHERE guid = 'VariableName' "
NewDao.RunSql(Sql)
I can make the code work when I manually replace the variable name with an actual value so I know the basic code is working, also in another label I am displaying the variable so I know it is retrieving the value from the URL OK
thanks in advance
_________________
Andrew Asher
www.it3.co.nz |
|
|
andash
Posts: 18
|
Posted: 01/14/2008, 5:31 PM |
|
Thanks to PeterR from Support: this is the solution.
Dim Request As HttpRequest = HttpContext.Current.Request
Dim NewDao As DataAccessObject = Settings.SQLServerDataAccessObject
Dim Sql As String = "UPDATE users SET Status = 'Y' WHERE guid = '"& VariableName &"' "
NewDao.RunSql(Sql)
_________________
Andrew Asher
www.it3.co.nz |
|
|
|