drpcken
Posts: 60
|
Posted: 08/18/2004, 12:49 PM |
|
Hey, I'm creating a session inside my code, but for some reason I keep getting publishing errors. It queries SQL and builds a select statement based on the value of the textbox 'login'. Here's my code:
'Control login Event OnValidate. Action Custom Code @8-73254650
' -------------------------
Dim sqlConn as New SqlClient.SqlConnection("server=(local);uid=sa;pwd=;initial catalog=IFPAWEB")
Dim sqlComm as New SqlClient.SqlCommand()
Dim sLogin as String
sqlConn.Open()
With sqlComm
.connection = sqlConn
.CommandType = CommandType.Text
.CommandText = "Select UserName from UserSecurity where UserID='" + login + "'"
End With
System.Web.HttpContext.Current.Session.Add("SessionName", sqlComm.ExecuteScalar)
SqlConn.Close()
' -------------------------
'End Control login Event OnValidate. Action Custom Code
and when I try to publish it, I get
C:\DOCUME~1\ADMINI~1.000\LOCALS~1\Temp\~IFPAWEB>C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\vbc /rootnamespace:IFPAWEB /t:library /out:bin\IFPAWEB.dll /imports:Microsoft.VisualBasic,System,System.Web,System.Xml,System.Data,System.Drawing /r:Microsoft.VisualBasic.dll,System.dll,System.Web.dll,System.Xml.dll,System.Data.dll,System.Drawing.dll /recurse:*.vb
Microsoft (R) Visual Basic .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.00.3705.288
Copyright (C) Microsoft Corporation 1987-2001. All rights reserved.
C:\DOCUME~1\ADMINI~1.000\LOCALS~1\Temp\~IFPAWEB\components\LoginDataProvider.vb(157) : error BC30452: Operator '+' is not defined for types 'String' and 'IFPAWEB.Data.TextField'.
.CommandText = "Select UserName from UserSecurity where UserID='" + login + "'"
This code works fine in my normal compiler, but I can't figure why its acting up here. WHen I replace the + login + with a static value, the session works fine.
THANKS!
|