A
Amateur
Dear Sirs
Some days ago I received an error message for my Globalsub.asp .
With you Forums help I repaired it (a part of the code is below)
Since it is repaired my ASP pages are not showing any data anymore. Here is
the code . Can someone tell me what I have done wrong?
<%@Language="VBScript"%>
<% OPTION EXPLICIT %>
<%
Response.Buffer = True
Response.expiresAbsolute=Now()-10
Response.expires=0
Response.addHeader "pragma","no-cache"
Response.addHeader "cache-control","private"
Dim CR
Dim LF
Dim CrLf
Dim QU
Dim Qs
CR=Chr(13)
LF=Chr(10)
CrLf=Chr(13)+Chr(10)
QU = Chr(34)
Qs = Chr(39)
Function FillFromDb(Tablename, Fieldname)
Set connFillFromDb = server.CreateObject("adodb.Connection")
connFillFromDb.Open
"dsn=access;database=f:\www.xxxxxxxxxxxxxxxxxxxxx.com\data\transferdb.mdb"
Sqlstr = "SELECT " + Fieldname + " FROM "+ Tablename
Set rsFillFromDb = connFillFromDb.Execute(Sqlstr)
TmpStr = ""
While rsFillFromDb.EOF <> True
If isnull(rsFillFromDb(Fieldname)) <> true then
TmpStr = TmpStr + CStr(Trim(rsFillFromDb(Fieldname))) + ";"
End if
rsFillFromDb.MoveNext
Wend
FillFromDb = Mid(TmpStr, 1, Len(TmpStr)+1)
rsFillFromDb.Close
connFillFromDb.Close
End Function
Function CreateSelectWithKey(Tablename, Fieldname, Keyname, ataffieldname,
curvalue, defaultvalue, sizeofbox, style)
Set connFillFromDb = server.CreateObject("adodb.Connection")
connFillFromDb.Open
"dsn=access;database=f:\www.xxxxxxxxxx.com\data\transferdb.mdb"
Sqlstr = "SELECT " + Fieldname +"," +Keyname+" From " + Tablename
Set rsFillFromDb = connFillFromDb.Execute(Sqlstr)
TmpStr = ""
TmpStr = "<select "+style+" size="+qu+ sizeofbox +qu+" name="
+qu+ataffieldname+qu+ ">"+ Crlf
If curvalue="" Then curvalue=defaultvalue
While rsFillFromDb.EOF <> True
If isnull(rsFillFromDb(Keyname)) <> true then
If CStr(Trim(rsFillFromDb(Keyname)))=curvalue Then
TmpStr = TmpStr +"<option selected
value="+qu+Trim(CStr(rsFillFromDb(Keyname)))+qu+">"+Trim(CStr(rsFillFromDb(Fieldname)))+"</option>"+Crlf
Else
TmpStr = TmpStr +"<option
value="+qu+Trim(CStr(rsFillFromDb(Keyname)))+qu+">"+Trim(CStr(rsFillFromDb(Fieldname)))+"</option>"+Crlf
End if
Some days ago I received an error message for my Globalsub.asp .
With you Forums help I repaired it (a part of the code is below)
Since it is repaired my ASP pages are not showing any data anymore. Here is
the code . Can someone tell me what I have done wrong?
<%@Language="VBScript"%>
<% OPTION EXPLICIT %>
<%
Response.Buffer = True
Response.expiresAbsolute=Now()-10
Response.expires=0
Response.addHeader "pragma","no-cache"
Response.addHeader "cache-control","private"
Dim CR
Dim LF
Dim CrLf
Dim QU
Dim Qs
CR=Chr(13)
LF=Chr(10)
CrLf=Chr(13)+Chr(10)
QU = Chr(34)
Qs = Chr(39)
Function FillFromDb(Tablename, Fieldname)
Set connFillFromDb = server.CreateObject("adodb.Connection")
connFillFromDb.Open
"dsn=access;database=f:\www.xxxxxxxxxxxxxxxxxxxxx.com\data\transferdb.mdb"
Sqlstr = "SELECT " + Fieldname + " FROM "+ Tablename
Set rsFillFromDb = connFillFromDb.Execute(Sqlstr)
TmpStr = ""
While rsFillFromDb.EOF <> True
If isnull(rsFillFromDb(Fieldname)) <> true then
TmpStr = TmpStr + CStr(Trim(rsFillFromDb(Fieldname))) + ";"
End if
rsFillFromDb.MoveNext
Wend
FillFromDb = Mid(TmpStr, 1, Len(TmpStr)+1)
rsFillFromDb.Close
connFillFromDb.Close
End Function
Function CreateSelectWithKey(Tablename, Fieldname, Keyname, ataffieldname,
curvalue, defaultvalue, sizeofbox, style)
Set connFillFromDb = server.CreateObject("adodb.Connection")
connFillFromDb.Open
"dsn=access;database=f:\www.xxxxxxxxxx.com\data\transferdb.mdb"
Sqlstr = "SELECT " + Fieldname +"," +Keyname+" From " + Tablename
Set rsFillFromDb = connFillFromDb.Execute(Sqlstr)
TmpStr = ""
TmpStr = "<select "+style+" size="+qu+ sizeofbox +qu+" name="
+qu+ataffieldname+qu+ ">"+ Crlf
If curvalue="" Then curvalue=defaultvalue
While rsFillFromDb.EOF <> True
If isnull(rsFillFromDb(Keyname)) <> true then
If CStr(Trim(rsFillFromDb(Keyname)))=curvalue Then
TmpStr = TmpStr +"<option selected
value="+qu+Trim(CStr(rsFillFromDb(Keyname)))+qu+">"+Trim(CStr(rsFillFromDb(Fieldname)))+"</option>"+Crlf
Else
TmpStr = TmpStr +"<option
value="+qu+Trim(CStr(rsFillFromDb(Keyname)))+qu+">"+Trim(CStr(rsFillFromDb(Fieldname)))+"</option>"+Crlf
End if