inStr searching and error producing

Results 1 to 3 of 3

Thread: inStr searching and error producing

  1. #1
    Nicola Guest

    Default inStr searching and error producing

    This is the insert code on my ASP. I want to search "THEPOEM" (which is a user-inputted text box on words.asp) for a certain word and kick back to words.asp with an error message if it is not there. I can&#039;t work out how to do it at all. Please help!<BR><BR>&#060;% <BR>strname = Request.Form("THENAME") <BR>stremail = Request.Form("THEEMAIL") <BR>strdate = Request.Form("THEDATE")<BR>strpoem = Request.Form ("THEPOEM")<BR>strIDlink= Request.Form ("IDlink")<BR>Dim oConn, sConnString, sSQL <BR>Set oConn = Server.CreateObject("ADODB.Connection") <BR>sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ <BR>"Data Source=" & Server.MapPath("Unblockdbdata.mdb") & ";" & _ <BR>"Persist Security Info=False" <BR>oConn.Open(sConnString) <BR>sSQL = "INSERT into wordentries (Name, Email, Entrydate, Poem, IDlink) VALUES (&#039;" & strname & "&#039;," & "&#039;" & stremail & "&#039;," & "&#039;" & strdate & "&#039;," & "&#039;" & strpoem & "&#039;," & "&#039;" & strIDlink & "&#039;);" <BR>oConn.Execute(sSQL) <BR>oConn.Close <BR>Set oConn = Nothing <BR>Response.Redirect("words.asp") <BR>%&#062; <BR>

  2. #2
    Join Date
    Dec 1969

    Default You should stay with your original thread

    I don&#039;t see Instr() in there at all. How is it producing an error if you&#039;re not even using it?

  3. #3
    Join Date
    Dec 1969

    Default Hmmmmm, I smell a repost....

    You are re-directing the user back to the words.asp after you have inserted the data into the database... Do you want to find the text before or after you search the database. It doesn&#039;t look like you have even tried to use the instr function anywhere... Where have you attempted to use it??? Personally I&#039;d check for the string at the beginning of the document...<BR><BR>eg....<BR><BR>if instr(1,thestring, "What to find") = 0 then<BR> redirect<BR>else<BR> Do your thing.<BR>end if<BR><BR>Do what desert Ghost said...<BR><BR>"Look up InStr() at the VBScript Reference on the toolbar to your left. "<BR><BR>Read up on the instr function, its rather easy to use...<BR><BR>-- Wholsea<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts