Home > Default > Asp code in Dreamweaver

Asp code in Dreamweaver

October 11Hits:0
How do I make this code work in Dreamweaver?
I need help badly.
' Declare variables
Dim strURL ' The URL of this page
Dim cnnSearch ' ADO connection
Dim rstSearch ' ADO recordset
Dim strSQL ' The SQL Query we build on the fly
Dim strSearch ' The text being searched for
Dim arrTerms ' An array of the terms in the search query
Dim strOperator ' Are we using AND or OR
Dim I ' Looping var
' Retreive the URL of this page from Server Variables
strURL = Request.ServerVariables("URL")
' Retreive the list of terms being searched for.
strSearch = Request.QueryString("search")
' FIgure out if the user requested an "AND" which only
' results which match all terms or an "OR" which returns
' which match any term.
If LCase(Request.QueryString("operator")) = "and" Then
strOperator = "AND"
strOperator = "OR"
End If
<p>Search our sample db by first or last name. (%
returns all)</p>
<form action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>" />
<select name="operator">
<option value="or" <% If strOperator="OR" Then
Response.Write(" selected=""selected""")%>>Any
<option value="and"<% If strOperator="AND" Then
Response.Write(" selected=""selected""")%>>All
<input type="submit" />
<p>[Try 'er in' for an example]</p>
If strSearch <> "" Then
' Create an ADO Connection to connect to the sample
Set cnnSearch = Server.CreateObject("ADODB.Connection")
' This line is for the Access sample database:
'cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Server.MapPath("database.mdb") & ";"
' We're actually using SQL Server so we use this line
cnnSearch.Open "Provider=SQLOLEDB;Data Source=;" _
& "Initial Catalog=samples;User
Id=samples;Password=password;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
' Double up single quotes
strSearch = Replace(strSearch, "'", "''")
' Split search phrase into individual terms
arrTerms = Split(strSearch, " ")
' Build our query based on the input.
strSQL = "SELECT last_name, first_name, sales FROM [sample]
' Loop over terms including each one.
For I = LBound(arrTerms) to UBound(arrTerms)
' I'm searching both first and last name fields so
' I need to do both for each search term.
strSQL = strSQL & "( last_name LIKE '%" &
arrTerms(I) & "%'"
strSQL = strSQL & " OR first_name LIKE '%" &
arrTerms(I) & "%')"
' Use the appropriate operator to combine the individual
search terms
If I < UBound(arrTerms) Then
strSQL = strSQL & " " & strOperator & " "
End If
Next 'I
' Order by last_name
strSQL = strSQL & " ORDER BY last_name;"
'Response.Write strSQL
' Execute the query
Set rstSearch = cnnSearch.Execute(strSQL)
' Display the results
<table border="1">
Do While Not rstSearch.EOF
<td><%= rstSearch.Fields("first_name").Value %>
<%= rstSearch.Fields("last_name").Value %></td>
<td><%= rstSearch.Fields("sales").Value
' Close our recordset and connection and dispose of the
Set rstSearch = Nothing
Set cnnSearch = Nothing
End If


dont try and use DW not worth the paper its writhen on all
people can do on this forum is just quote u not help you, try and
use crimson editor or 1st page 2000 to edit your asp code cause you
wont do it in DW
hahahahahahahahahahahahahahah DW this software is

Read other 3 answers


Related Articles

  • Asp code in DreamweaverOctober 11

    How do I make this code work in Dreamweaver? I need help badly. <% ' Declare variables Dim strURL ' The URL of this page Dim cnnSearch ' ADO connection Dim rstSearch ' ADO recordset Dim strSQL ' The SQL Query we build on the fly Dim strSearch ' The t

  • Sql injection attack - need help changing ASP codeOctober 11

    Our web server was attacked yesterday by SQL injection. So I quickly learned about the holes in the code that was generated by Dreamweaver MX 2004. I found the help article on the Adobe website to fix the ASP code; however I need more information for

  • Crystal report run from ASP code significantly slower than when run in CRSOctober 11

    We have CRS XI R2.  I developed a report that contains several on-demand sub-reports.  The report and sub-reports are very fast when run directly from CRS.  However, when I run from ASP (users run a link from the intranet), it takes 4 times longer (1

  • How to create a asp page in dreamweaver cc 2014October 11

    How in the hec do I create an asp page in Dreamweaver CC. I installed the database, server behaviors.  I can create a PHP page and add database connections for that type but not Asp? Help anyone? Thanks TraciCreate a new HTML document. Go to File > S

  • How to change Crystal Reports XI database name at run time from ASP code using ADOOctober 11

    Dear All, I need advises regarding to my problem below I have two database in same SQL 2005 SERVER for TEST01 and LIVE01 Environtment, and I've created more than 100 reports with Crystal Reports 11 and call it from ASP classic page. The problem is ho

  • How do I edit my Android Apps Code in dreamweaver? As well I can't find any of the App options that I keep hearing about in my cloud based Dreamweaver.....October 11

    I already have an app that I paid someone to make but I needed to make some changes to the code and wanted to do it in Dreamweaver. How is it best to load my code into Dreamweaver, navigate through it, and find the code I need to change? As well my v

  • Flash code into Dreamweaver - Help please!October 11

    I am using GoDaddy for my hosting account. It is on a linux server. I have created an HTML page and loaded it up to the internet using Dreamweaver, like I normally do. the page in question is http://www.desmoinesbilliards.com/gallery.html When I use

  • Newbie to JSP, Need to convert some ASP code to work for JSPOctober 11

    Can I get some aid in converting the following ASP code to work using JSP. I have never used JSP before but I now need to because of a recent server change. <% DIM URL URL = LCase(Request.ServerVariables("URL")) if InStr(URL, "/about/&qu

  • How to disable refresh every time I write code in dreamweaverNovember 30

    Hi....how to disable refresh every time I write code in dreamweaver...thank very much.Hi.......every time I write code or content on the web, from interfce code, I get a message on the bottom of the program, with a button that says "refresh"...

  • Can use asp code in xsl page?November 30

    hello, i want to know can i use asp code in xsl page ..if so, please let me know. thz nway ngeHi, now we have the tinyMCE editor, where you can insert and edit html-code. It works fine now for the layout, but there are still a few problems with the l

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.793 s.