Forum Moderators: open
I get a compiler error:
Compiler Error Message: BC30451: Name 'pidnumber' is not declared.
Source Error:
Line 51: dbConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath(dbName))
Line 52: dbConn.open()
Line 53: SqlStatement = "SELECT pid,Name,cat_id,Price,brand_id from product_search WHERE pid='" & pidnumber.value & "'"
Line 54: dbComm = new OleDbCommand(SqlStatement, dbConn)
Line 55: dataread = dbComm.ExecuteReader()
How can I solve this? Do I need to change the scope of the pidnumber variable somewhere in my code?
Protected WithEvents pidnumber as system.web.ui.webcontrols.textbox
...select what ever control you are using.
If you are using a generic HTML control and want to access it that way you need to be sure to add "runat=server" to the control and then declare it in code as well like:
Protected WithEvents pidnumber as system.web.ui.htmlcontrols.htmltextinput
...use whatever control type you need..