---
title: "Replace"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/14267-replace"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "FIgg3"
published: "2002-02-07T17:08:00.000Z"
updated: "2002-02-07T18:20:00.000Z"
replies: 4
views: 290
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/14267-replace"
---

# Replace

## #1 — FIgg3, 2002-02-07T17:08Z

Hejsan.... Ja sitter här tänkte göra en räknare i bilder och så tänkte ja använda replace men ja vet ej riktigt hur ja ska göra tänkte så här 

```
<%
Set Connect = Server.CreateObject("ADODB.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};"
DSNtemp=dsntemp & "DBQ=" & Server.MapPath("counter.mdb")
Connect.Open DSNtemp
SQLstmt = "SELECT hits FROM total"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLstmt, Connect, 3, 3

Function forumKod(strText) 
strText = Server.HTMLEncode(strText) 
strText = Replace(strText,"0","img scr='0.gif'") 
strText = Replace(strText,"1","img scr='1.gif'") 
strText = Replace(strText,"2","img scr='2.gif'") 
strText = Replace(strText,"3","img scr='3.gif'") 
strText = Replace(strText,"4","img scr='4.gif'") 
strText = Replace(strText,"5","img scr='5.gif'") 
strText = Replace(strText,"6","img scr='6.gif'") 
strText = Replace(strText,"7","img scr='7.gif'")
strText = Replace(strText,"8","img scr='8.gif'") 
strText = Replace(strText,"9","img scr='9.gif'") 
 
strText = TRIM(strText) 
strText = Replace(strText,vbcrlf," <br>") 
forumKod = strText 
End Function 

%>
```

men den funkar ej har ni några andra förslag, själv står det ganska still

Permalänk: https://www.webforum.nu/p/14267

## #2 — FIgg3, 2002-02-07T17:11Z

Glöm det, förlåt det var bara ja som glömde en sak :) tänk vad små = kan göra :)

Sorry änu en gång...

Permalänk: https://www.webforum.nu/p/309736

## #3 — FIgg3, 2002-02-07T17:33Z

Hejsan.. ja löste juh första problemet själv men nu kom ja på att ja hade ett annat problem....

```
Function forumKod(strText) 
strText = Server.HTMLEncode(strText) 
strText = Replace(strText,"0","<img src=0.gif width=4 height=5>")
strText = Replace(strText,"1","<img src=1.gif width=4 height=5>") 
strText = Replace(strText,"2","<img src=2.gif width=4 height=5>") 
strText = Replace(strText,"3","<img src=3.gif width=4 height=5>")
strText = Replace(strText,"4","<img src=4.gif width=4 height=5>") 
strText = Replace(strText,"5","<img src=5.gif width=4 height=5>") 
strText = Replace(strText,"6","<img src=6.gif width=4 height=5>") 
strText = Replace(strText,"7","<img src=7.gif width=4 height=5>")
strText = Replace(strText,"8","<img src=8.gif width=4 height=5>")
strText = Replace(strText,"9","<img src=9.gif width=4 height=5>")

 
strText = TRIM(strText) 
strText = Replace(strText,vbcrlf," <br>") 
forumKod = strText 
End Function 

%>
```

När ja kör den koden funkar det bra i räknaren och den gör som ja vill men när räknaren i databasen gör över 9 till 10 eller över så funkar det inte... ja trode att den skulle göra det auto men icke så är det någon som har någon bra lösning?

Permalänk: https://www.webforum.nu/p/309737

## #4 — FIgg3, 2002-02-07T18:20Z

Ingen som kunnde fixa detta?
Men ja hitta en lösning genom en kompis

```

  <%
Set Connect = Server.CreateObject("ADODB.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};"
DSNtemp=dsntemp & "DBQ=" & Server.MapPath("counter.mdb")
Connect.Open DSNtemp
SQLstmt = "SELECT hits FROM total"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLstmt, Connect, 3, 3

For i = 1 To Len(RS("hits"))

Response.Write("<IMG SRC=""" & Mid(RS("hits"),i,1) & ".gif"">")

Next

%>
```

Mvh

Permalänk: https://www.webforum.nu/p/309738

## #5 — FIgg3, 2002-02-07T18:20Z

Ingen som kunnde fixa detta?
Men ja hitta en lösning genom en kompis

```

  <%
Set Connect = Server.CreateObject("ADODB.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};"
DSNtemp=dsntemp & "DBQ=" & Server.MapPath("counter.mdb")
Connect.Open DSNtemp
SQLstmt = "SELECT hits FROM total"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLstmt, Connect, 3, 3

For i = 1 To Len(RS("hits"))

Response.Write("<IMG SRC=""" & Mid(RS("hits"),i,1) & ".gif"">")

Next

%>
```

Ps (för er som vill se hur det blev kolla in <http://rubensoft.d2g.com/figg3> ) 

Mvh

Permalänk: https://www.webforum.nu/p/309739

---

Tråden på webben: https://www.webforum.nu/amne/asp/14267-replace
