Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: & operator error


Message #1 by "Anita Datar" <anita.datar@a...> on Tue, 17 Dec 2002 08:49:10
I am getting the following error.

Operator & is not defined for types string and 
systems.web.ui.webcontrols.textbox.

The code line is as follows

Dim strSQL as string

StrSQL = "Insert into employee (employeeno, name) values (" & strEmpNo 
& ",'" & strName & "')"

Can anybody tell what is the problem.


Regards,
Anita
Message #2 by "Peter Lanoie" <planoie@n...> on Tue, 17 Dec 2002 09:35:39 -0500
Am I correct in assuming that "strName" is of the type
"systems.web.ui.webcontrols.textbox"?
If that is the case, then all you need to add is ".text" to that object.
You can't concatenate a string with an object (the text box) given they are
different types.  You need the text property of that text box.

<snip>
StrSQL = "Insert into employee (employeeno, name) values (" & strEmpNo &
",'" & strName.text & "')"
</snip>

That should do it.

-Peter

-----Original Message-----
From: Anita Datar [mailto:anita.datar@a...]
Sent: Tuesday, December 17, 2002 08:49
To: aspx_beginners
Subject: [aspx_beginners] & operator error


I am getting the following error.

Operator & is not defined for types string and
systems.web.ui.webcontrols.textbox.

The code line is as follows

Dim strSQL as string

StrSQL = "Insert into employee (employeeno, name) values (" & strEmpNo
& ",'" & strName & "')"

Can anybody tell what is the problem.


Regards,
Anita


  Return to Index