Where to add the Include File

  • Thread starter Thread starter Steven K
  • Start date Start date
S

Steven K

Hello,

I have an include file (../../Connections/pricex.inc). That I use to
declare my variables and build my connection string. I tried using the
following, but got the error: Compiler Error Message: BC30188: Declaration
expected. If I move "Response.WriteFile" statement into the sub block, I
get the error that my variables are not declared.

My question is, where and how do I add the include file?


<script runat="server">
Response.WriteFile ("../../Connections/pricex.inc")

Sub Page_Load(Sender As Object, E As EventArgs)

spSearch = New SqlDataAdapter("sp_web_Search " &
"'FindRegionSubRegion','','',''", cnnSearch)
spSearch.SelectCommand.CommandType = CommandType.StoredProcedure

'Close Out the connection
spSearch = Nothing
cnnSearch.Close : cnnSearch = Nothing
End Sub
</script>
 
I dont think you can do what you are trying to do - variables cannot be
declared like this in .net. You could put them in a class, and invoke an
instance of the class, referencing the variable properties in the class
instead. Then they would be available in your page events.

Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 
Hello Steven,
Steven K said:
Hello,

I have an include file (../../Connections/pricex.inc). That I use to
declare my variables and build my connection string. I tried using the
following, but got the error: Compiler Error Message: BC30188: Declaration
expected. If I move "Response.WriteFile" statement into the sub block, I
get the error that my variables are not declared.

My question is, where and how do I add the include file?
Don't use include files!!!!!!!!!!!!!

first the are not secure! - everybody can read them .... try in the internet
explorer ---> connections/pricex.inc...!!

Make a connection class!

mfg simon g.
 
Back
Top