|
hi there..i need help in connection again,..i got two files..one is my connection file the other one is DataEntryId which also linked to the connection file..but i keep encountering error which i cant solve...error type as below :
Error Type:
Server.MapPath(), ASP 0171 (0x80004005)
The Path parameter must be specified for the MapPath method.
/spis/Connections2.inc, line 24
Connection file codes :
<%
dim err
dim conn
dim rs
dim rs2
dim strBuffer1,strBuffer2
dim varDatabaseName
varDatabaseName="silkair.mdb"
%>
<%
`sub CloseConnection
`conn.close
`set rs = nothing
`set conn = nothing
`end sub
%>
<%
sub Connection
strBuffer1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strBuffer2 = server.mappath(varDatabaseName)
set err = server.createobject("ADODB.error")
on error resume next
set conn = server.createobject("ADODB.connection")
conn.connectionstring = strBuffer1 & strBuffer2
conn.Properties("Jet OLEDB:Database Password") = "1234"
conn.open
set rs = server.createobject("ADODB.recordset")
Set rs2 = Server.CreateObject("ADODB.Recordset")
rs.activeconnection = conn
rs.locktype=3
rs2.activeconnection = conn
rs2.locktype=3
end sub
%>
*** error line: strBuffer1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
---------------------------------------------
DataEntryId codes :
<%
Dim lquarter
Dim sFilename
Dim year
Call Connection
varSqlStatement = "SELECT * from DataEntry"
rs.open varSqlStatement
Call CloseConnection
Call Connection
varSqlStatement = "SELECT DataEntryId From DataEntry ORDER BY DataEntryId DESC"
rs.open varSqlStatement
year = trim(left(rs.fields("DataEntryId"), 6))
Call CloseConnection
Set objFSO = CreateObject("Scripting.FileSystemObject")
rs.MoveLast
sFilename=trim(left(rs.fields("DataEntryId"),6))
rs.MoveFirst
`If not objFSO.FileExists (sFilename&"/forum/.txt") Then
`objFSO.CreateTextFile (server.mappath(sFilename&"/forum/.txt"))
`End If
Set objTextFile = objFSO.CreateTextFile(server.mappath(sFilename&"/forum/.txt"),True)
objTextFile.WriteLine "DATE : " & Date() & " at " & Time() & "."
objTextFile.WriteLine ("DataEntryId QnSetId FlightDate FlightNo StationId Quarter")
do while not rs.eof
objTextFile.WriteLine rs.Fields("DataEntryId") & " " & rs.Fields("QnSetId") & " " & rs.Fields("FlightDate") & " " & rs.Fields("FlightNo") & " " & rs.Fields("StationId") & " " & rs.Fields("Quarter")
rs.MoveNext
loop
Set objFSO = Nothing
query="Delete * From DataEntry"
conn.Execute(query)
%>
|
|
|
<%
sub CloseConn(conn)
conn.close
` set rs = nothing
set conn = nothing
end sub
sub Connection(conn,DBName)
strBuffer1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strBuffer2 = DBName
` set err = server.createobject("ADODB.error")
` on error resume next
set conn = server.createobject("ADODB.connection")
conn.connectionstring = strBuffer1 & strBuffer2
`conn.Properties("Jet OLEDB:Database Password") = "1234"
conn.open
` set rs = server.createobject("ADODB.recordset")
` Set rs2 = Server.CreateObject("ADODB.Recordset")
` rs.activeconnection = conn
` rs.locktype=3
` rs2.activeconnection = conn
` rs2.locktype=3
end sub
dim err
dim conn
dim rs
dim rs2
dim strBuffer1,strBuffer2
dim varDatabaseName
varDatabaseName=Server.Mappath("silkair.mdb")
Call Connection(conn,varDatabaseName)
Call CloseConn(conn)
%>
|
|
|
|
|
|
|
|
|
|