Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

include a file in asp.net

Status
Not open for further replies.

nam4520

Programmer
Jan 7, 2003
14
US
i want to include this code snippet in an asp.net file and include it in every page where I need to open up my database. it was straightforward in asp. how do i get it done in asp.net? thanks

'this opens up my database

sub page_load(sender as object, e as eventargs)
Dim strConnectionString As String
strConnectionString="Provider=MSDASQL;DSN=SwisODBC;UID=SYSDBA;PWD=asdf"
End Sub
 
Hello,

Have a look at this thread: thread855-464574.
Hope this answer to your question.
 
The simple way to do this is to add a module to your project and add this at the top ov it :

Public Dim strConnection as string = "Put your connection string here."

Then any time you need to use the connection string simply use "strConnection"

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top