close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dreamweaver SQL returning extra results

Thread began 1/03/2010 4:17 am by m_jelly386415 | Last modified 1/04/2010 12:26 pm by Jason Byrnes | 1124 views | 1 replies |

m_jelly386415

Dreamweaver SQL returning extra results

I'm having a problem with my database search query. It comes from a form asking either title, author or isbn - requesting a title returns perfection, requesting an author or isbn returns the correct result, plus 2 seemingly random results - but the same 2 odd results every time for every query.

Thanks

Dim SearchQuery__MMColParam
SearchQuery__MMColParam = "1"
If (Request.Form("title") <> "") Then
SearchQuery__MMColParam = Request.Form("title")
End If
%>
<%
Dim SearchQuery__MMColParam2
SearchQuery__MMColParam2 = "1"
If (Request.Form("author") <> "") Then
SearchQuery__MMColParam2 = Request.Form("author")
End If
%>
<%
Dim SearchQuery__MMColParam3
SearchQuery__MMColParam3 = "0"
If (Request.Form("isbn") <> "") Then
SearchQuery__MMColParam3 = Request.Form("isbn")
End If
%>

<%
Dim SearchQuery
Dim SearchQuery_cmd
Dim SearchQuery_numRows

Set SearchQuery_cmd = Server.CreateObject ("ADODB.Command")
SearchQuery_cmd.ActiveConnection = MM_conn_STRING
SearchQuery_cmd.CommandText = "SELECT * FROM Stock WHERE title LIKE ? OR author_last LIKE ? OR isbn=?"
SearchQuery_cmd.Prepared = true
SearchQuery_cmd.Parameters.Append SearchQuery_cmd.CreateParameter("param1", 200, 1, 255, "%" + SearchQuery__MMColParam + "%") ' adVarChar
SearchQuery_cmd.Parameters.Append SearchQuery_cmd.CreateParameter("param2", 200, 1, 255, "%" + SearchQuery__MMColParam2 + "%") ' adVarChar
SearchQuery_cmd.Parameters.Append SearchQuery_cmd.CreateParameter("param3", 5, 1, -1, SearchQuery__MMColParam3) ' adDouble

Set SearchQuery = SearchQuery_cmd.Execute
SearchQuery_numRows = 0
%>

Sign in to reply to this post

Jason ByrnesWebAssist

you have the default values for the recordset parameters set to 1 and 0, try changing those to -1 for all of them.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...