trying to us RELATIVE PATH ON MY CONNECTION STRIN

  • Thread starter Thread starter RAW
  • Start date Start date
R

RAW

Hi Im trying to us relative path in my connection string instead of absolute
what Im doing wrong this is my code

Sub Page_Load() Dim strConnection as String =
"Provider=Microsoft.Jet.OLEDB.4.0;" strConnection += "Data
Source=Server.MapPath("../dbcontainer/content.mdb") data_src.text =
strConnection
 
What is the exception and what does server.mapppath return?

This by the way is not a good idea to build a connection string because you
will not be taking adantage of the connection pooling in the framework.
Connection pooling uses a exact match algorithm. Most times, building
strings does not result in a exact match.

regards
 
simple questions
with a simple answers

relative connection
Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="& _ 'Server.MapPath("../NEWMGS/dbcontainer/content.mdb")

Absolute connection
Dim strConnection as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\works\WEBS\NEWMGS\dbcontainer\content.mdb" DIM setNiveles AS
INTEGER DIM setContenido AS STRING DIM setPagina AS STRING
 
Back
Top