Left And Instr Functions
I am having a problem with the following code:
<%
If Len(TestRS.Fields.Item("Testimonial").value) > 150 Then
Response.Write(Left(TestRS.Fields.Item("Testimonial").Value,150)&""... <br><font size=1><a href=""/Testimonials.asp"">Read More</a></font>")
Else
Response.Write(TestRS.Fields.Item("Testimonial").Value)
End If
%>
I am getting a null response from TestRS.Fields.Item("Tesimonial").Value after it is processed by the Len function.
I am getting the following result: Quote: "... Read More This tells me that the len function is analysing the string to be greater than 150 charachters yet the string is not being expressed.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Instr
Why does this code Code: Dim mytext mytext = "Tristique, sed tamen typicus amet, bene quia feugait eu. " Response.Write Instr(mytext, "tamen") Gives the response "16"? Surely this word only appears once? Is it counting letters? How can I make it identify just words?
InStr
How do I use InStr to find the string d="1" I have tryed: InStr(text,"d="1"") and it does not work I have tryed a few other variations and I cant get it to work.
Access, Not Instr
I dont want those Disp selected from access db...I am getting an error..How will I do that ? Microsoft VBScript runtime error '800a000d' Type mismatch: '[string: "49, 50"]' /drv_sch/Generate_Sch.asp, line 55 ---------------------------------------- Driver_id is a number...Disp variable has these data "49, 50, 51" SELECT * FROM schedule WHERE not instr('Disp',driver_id)
Odd Left() Error
I'm doing some text manipulation and I'm getting a strange error. My code is: [vbs] modT = trim(left(CommandArray(x), inStr(CommandArray(x), "-") - 1)) [/vbs] CommandArray is an array created by a split() statement (so it contains strings). It's content at the time if execution (if I response.write it) is "Policies -name:Board -public:yes". What I the line above to do is return "Policies". All the math should work out, but I get this error: Code: Error Type: Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument: 'left' buildLinks.inc, line 10 Line 10 is the line pasted above.
Remove Left Of ,
Would search for this but forgot what its called? I wanna remove everything from the left of the camma in a variable: 43,7-3-05 to 7-3-05
Instr Searches
I am searching a string that look like this (21,5,15,25) using Instr(). So, if I am searching for '5', I get everything that contains a five. If InStr("21,5,15,25", req,QuerStr("id") Then response.write "yes" End If I want only the one value '5' to get found but anything that contains a 5 is found. I have tried using Cint and Int to no avail.
Left Join
i got two tables (sDetail and newTable).i'm using a left join to find the dif from the two tables using the pk tutor on both tables . then i need to display the table dif on my browser but where am i suppose to take the result from?
InStr, Substr, Mid
I have a field name "tracks" of string data type that has multiple names in it (for example: calder delaware$ aqueduct ), and I want to check to see if this certain field has "delaware$" in it. InStr or the Mid functions return the numerical order of where that string starts inside the string, but it doesnt tell me if "delaware$" exists in "tracks".
Left Outer Join
I am working with two databases. One is dockets which holds all kinds of information about upcoming legal hearings. The second one is additional parties which holds additional records related to the dockets data table. Not all dockets have additional parties so when I need to display information about a case I may or may not need records from there so I am using a left outer join. It works perfectly EXCEPT for one small matter. The field that I am joining on (petitionCaseNumber) is turning up empty after the join. Below is the join. varSQL = "SELECT * FROM Dockets LEFT OUTER JOIN additionalParties ON Dockets.petitionCaseNumber = additionalParties.petitionCaseNumber WHERE dockets.petitionCaseNumber = '" & numberIn &"'" When I say something like response.write rst("petitionCaseNumber") I get nothing if I say response.write rst("dockets.petitionCaseNumber") I get an error. How do I refer to this field or how do I get this field to contain the case number?
Grabbing Left/right Of A Variable Name
I have several checkboxes named in the following format: chktable_city~20 chktable_state~WI chktable_zipcode~12312 I need to be able to pull the table names and values from each checkbox name (for example, I would need to pull the "table_city" and "20" from the checkbox above). In short, how do I pull out the table_city and 20 from the first example. Since the table names and values vary in size, I can't just do a regular mid, left, right function.
Should I Use LIKE Or InSTR For A Database Search?
Which is better practice? Code: Select * From groups Where groupName LIKE '%bli%' AND cusType LIKE 'CUST%' or Code: Select * From groups Where InStr(groupName,'li')>0 AND InStr(cusType,'CUST')=1 Right now I'm using and Access database but plan to upsize to a MSSQL if that makes any difference. Are there any advantages or disadvantages to either technique?
User Has Left The Building
How do I register that a user has left the website or page? I'd like to show "users online" and "users on this page" counters.
InSTR Is Case Sensitive
Just used this code and noticed it doesn't always work, turns out InStr is case sensitive.What's thet best way to do a non-case sensitive search?pHP Code: IF INSTR(VideoName,"HiRes") THEN
Instr Type Function
I've been given a large database of "model numbers". based on these model number I have to do something different. example model numbers: B2020-SG1 B2020-SG4440 B2020-LG3 B2020-LG33E B2020-SG1-SG1 B2020-SG1TD9-SG1 B2020-SG1TD15-SG4440 Basically, the first number (B2020, which could be a number of different numbers) is the model. the second and/or third number is what I have to act on. The problem is, how do I pull that third number? Especially if its the same as the first number. right now I'm using Instr(variable1, "SG1") to pull each different set of numebrs. but that only finds the first occurence. what about the 2nd? how can I find that?
Instr Function Generates Error
My question is I use: ----------------------------- dim strText,pos strText = "This is a test!!" pos = Instr(strText,"a",1) response.write pos ----------------------------- and i get: Type mismatch: '[string: "This is a test!!"]' What's going on?
Tidy Connections Left Open
Many a page has ADO Connection objects that were opened but never closed. The Connection object allocates its own resources when it is opened. When the object goes out of scope without being explicitly closed, the resources ASP allocated for it are freed, but the resources it allocated on its own are not. These eventually clutter up the server and slow it down to a crawl. My question is, is there a way to track down these orphaned resources and forcibly free them from ASP, without restarting IIS or the server? Or does one have to wait for the unused Connections to time out and release themselves? I know that good coding practice is best, but is there a temporary fix to tidy up these connections left open?
Left Function Excluding Alphabets
am using an XML feature to web crawl on my provider's site to get a response of an sms message sent. Am using code: ehioze = left(sResult,3) However, i only want the results of ehioze only if its numeric characters. and if there are any alphabets, it shoudl exlude it. How woudl this be done ?
Combine The LEFT And VbCrLF Thingy
I have used thecode which is below to get x characters on to display <%= LEFT(rsName.Fields.Item("columnname").Value,50)%> It works fine but when I use this same code to get x characters plus display it using VBCRLF, with the <br> with writing the code : <%=Replace LEFT (Recordset1.Fields.Item("Detail").Value,VbCrLf,"<br><br>",50)%> it gives me error so please can you tell me how can i trim the characaters and at the same time use VBCRLF. why does this above code with LEFT + vbCrLF doesn't work.
How To Track The Time Left In Database
When a student taking a quiz having a duration of 2 hrs, a timer will start and keep track the time. So if he logout or close the window, the remaining time should be recorded into the database. And when he take the same quiz again, the timer will not restart but continue from the previous time. E.g i take a quiz having a duration of 60mins, and when i logout the time duration remain is 30mins. And when i logon and take the quiz again, the timer countdown from there 30mins but not begining of 60mins.
Case Dependancy Trouble With InStr() And Mid()
I'm having some trouble with an error that is thrown when I use InStr() and Mid() with a database search query. In point form: I am retrieving an array strings from my database where the query is case insensitive. This is good. Then I locate the keyword in the string using InStr() which is case sensitive. This is not desireable as it doesn't recognize all instances of the keyword. I use the Mid() function to give me a portion of the string starting at the location provided by InStr() which is sometimes the number zero which in turn throws the error.
Using The JOIN LEFT Function In A Statement
I am currently having a problem with one of my ASP pages; Currently, in the SELECT, I am using JOIN LEFT functions which work fine (see the code below). However, I have now created a new table which I have successfully linked to the other tables. However, I am not sure how I would word the JOIN LEFT statement for the new table. The new table is located at Report.Report I have tried to have a go, but am I missing something? I always get an error message saying, Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation. Code:
How Do I Make A Repeat Region On A Recordet Go Left To Right Instead Of Just Down
I have a dynamic driven web page which get's a select value from the menu choice. I querry the database recordset and pull back the correct values. I want to display them in a grid fashion. I want to limit how many items per page are show in each grid and then I'll use the standard DW behaviors to move to next page, etc. The challenge I have is making the repeat region go left to right instead of repeating down.
String With Commas, How To Use Instr And Mid Function In A Loop?
I have a string --> 7,8,9,10. This string may contain more or less than 4 numbers. I want to separate each number and run an sql query for each number. for example: select * from table1 where code = '7' select * from table1 where code ='8' and etc.... Can I do this in a loop?
Invalid Procedure Call Or Argument: 'InStr'
I get this error melding >>>Invalid procedure call or argument: 'InStr' and this is the code where this error refers to: If (InStr(r, UCase(strRetVal), "<TABLE>") > 0) AND _(InStr(r, UCase(strRetVal), "<TABLE>") < _ InStr(r, UCase(strRetVal), "</TD>")) then ThisCellText = mid(strRetVal, StartCellText, _ InStr(r, UCase(strRetVal),"<TABLE>")- StartCellText ) Else ThisCellText = mid(strRetVal, StartCellText, _ InStr(r, UCase(strRetVal), "</TD>")- StartCellText ) End If in this area i am doing something, can anyone plz direct me and tell whats wrong?
HOWTO: Detect Outgoing Email Has Left Queue Folder
I can send email using C# and SMTP, but keep closing the connection before the .eml file has left the Queue folder. The length of time the .eml file stays in the Queue folder is dependent on the size of that file; big or many attachments increases the time. If I start an internet connection, issue the smtp mail send and then close the connection in my C# program, I need to wait until the .eml file has left the Queue folder. Otherwise, prematurely closing the internet connection causing IIS to abort the send. How can I detect that the .eml file has left the Queue folder?
LEFT JOIN On A Date Field And A Numerical Field - Using WHERE Clause
I am using a Relational database for my site and i have the following tables: FIXTURES, GAMEDATES the fields in FIXTURES are: GameDate Home Away (All of the above are numerical fields) the fields in GAMEDATES are: DateID(integer) GameDate(#Date Field#) What i have done is in the GAMEDATE field in the FIXTURES table i have used the ID number of the date that i wish to assign to that record - using a LEFT JOIN to display the actual date that is pulled from the GAMEDATES table (That which corresponds to the relevant id used in Fixtures) The problem is that in some of my code i want to display records using sql and sometimes in the where clause i use the following: WHERE Fixtures.GameDate<=(Date()) obviously meaning WHERE GAMEDATE is LESS THAN or EQUAL to TODAY. The thing is when i use the join it does not use the where clause and displays all of the records in the FIXTURES table. Does any one know how to get around this, i have not received any error messages it just isnt displaying the right data
How Reload Left Frame When A Form Is Submited On The Righ Frame?
I got a asp page that has right and left site frame. I got a form in the right side frame and i want it reload the left frame when the it got submited .The left side frame displays that content of newly sumitted form.I be happy if some one help reload this left page when a form got submitted in right side frame with out using any auto refresh.
Using Functions
I have a file i created it contains several functions, and some other code to build a string based on diffrent vars.If i run this file standalone, it works absolutly fine. However the problem comes when i include it half way in another script. I get the following.. VBScript Error 800a03ea test4.asp, line 2 function encr.. This is line 2 Function Encrypt(Message, EncryptionKey)
Functions
I am searching for a function that can separate a string var to some string vars and devide the string by "," marks, os this possible? example: str1 = "2,34,1,54" and I want "2","34","1" and "54" be devided and inserted into new vars, or an array var, is their a VBscript function for this? I have made a function myself that does this using ths Instr and the Mid functions, but its quit messy and I don't wan't to have to insert it in every page I make, Any Ideas? Another small thing, I want to learn how to use Classes in ASP, I don't know what to look for exactly, (vlince, I could use a link now...)
Functions
<%= functionName(value1, value2) %> Trying to call a function which returns the modulo of two numbers, can l simply whack the function name in and the value will be returned ?
Functions In Asp
I've written the following function but somehow the output is not what I want it to be. Can someone explain to me what i'm doing wrong? function fn_piping(inputWaarde) outputwaarde = inputwaarde Response.Write outputwaarde & "<BR>" if i = 1 then i = 2 call fn_piping("thisshouldbethefinaloutput") else fn_piping = outputwaarde end if end function i = 1 figure = fn_piping("bla") Response.Write "<BR>" & figure So 'thisshouldbethefinaloutput' should be the final output, but it doesn't output anything?!
Sub/Functions With FOR
I need a current record in the database for it to work but I have another page that uses this same code and it works fine on that and the only thing different in the coding is where the information is being pulled from in the database and when i first copied & edited the page it worked fine but now it doesn't and i've worked on it .....
Functions
I would like to call a asp function when i click a button in a form. I'm using VB. I know in Javascript it the onclick event is there a similar handler in VB????
Calling Functions...
Where's the best place for me to include all my functions that I want to call throughout different pages? Should I just put them all in one ASP file and include that page on every page? Or use global.asa somehow (how??)? Anyways, I was just wondering because I didn't want to slow things down if I could help it (I didn't know if having another big file attached to every page when I'm just using a small portion of it was very effective or not)
Date Functions
i am wondering how to actually get the month in letters..... i have used a strMonth = Month(Date) but it is returning a number of the month... i would like to make this the actual month such as January, August, etc.... how would i go abt doing this in ASP.....
ASP Apps And Functions
Over my years developing ASP applications and writing asp code in general I have created a library of nice little apps and functions that I use over and over again. I was "thinking" about maybey setting up a site with all my useful functions, subroutines, and possibly applications for people to download and hopefully donate some money if they use them. Perhaps even have some apps for sale only. The apps will mainly be my useful plugin developments such as guestbook, gallery, login system etc. My question however is do you think it would be worth the time and effort? Do you find yourself using plugins a lot? I defo think the functions could be handy but again how many of you search for functions to help you out or indeed how many of you currently use functions you have gotten from other people? Would you donate something if you used them? Mayby some of you have already done something like this and can let me know how you got on?
Math Functions...
Didn't remember if anybody had started started like this, but I decided it would be cool to start it again. If you have a math function request ask it below, or if you have made one then add it: I have a few cretegean plane (think thats how you spell it), calculations. One request I have is, does anybody have a short function for square root?
Multiple Functions
I have some code I am working on. One function reads a file using fso, then I have multiple functions using the string read from the file. Each function splits the lines up and will return one value. Is there a better way? Is handling this many array which are basically the same going to cause some server distress
Lack Of Functions
I know there is the function IsNumeric() in ASP and we have a SUM function in SQL, but why don't we have the following functions in ASP: Code: Sum() IsAlphabetic()
Reusing Functions
I have been developping a webpage in ASP for about 4 weeks now and I have noticed that I am rewriting similar functions in pretty much every page i make. So I was wondering if there is a way to make some particular functions global so that you can use them in any page. The functions will depend on the session id, but I don't know if i can declare session functions or not.
Functions Question
In this function i pass variables to it to find out if a record exists, what i want to do next is call this function and if a record does not exist pass a variable out like Statement = False and then pick up that value on the page that i call the function. Can this be done? I was thinking perhaps using a Session? Code:
NOW() And DATE() Functions
So i am inserting Now() or Date() (Either one will work for what i want), into one of my fields. But it is returning the Server time, which is about 17 Hours behind of what i want. Is there anyway to insert Australian time, as in where i am situated?
VBScript Functions
I'm a PHP programmer. That said, I recently began a job where a good third to half of the applications are written in ASP.NET. VBScript, to be precise. As I've done programming for years (C/C++, PHP, JavaScript, BASIC... the list goes on and on), picking this up hasn't been too difficult, but I now find myself facing a question that I simply cannot find an answer to anywhere: Can one define a function that has optional parameters in VBScipt? If not, can it be done in C#, and can C# code be easily integrated into pages written in VBScript?
Best Way To Call Functions?
I have written a very complex web app for intranet use. It allows users to search a large database and then returns formatted results. I am currently employing a method as below: Code:
Date Functions
if there was a function in ASP that checks a date to see if it is valid or not. I am aware of the IsDate function, but I think its not what I'm looking for. I want to run the following date through a function and have the function tell me that it is invalid: 31-Feb-2003 (cos there is not 31 days in Feb). Or a good way to make my own function?
Functions Pass By
I have a function called GetRS which takes in a SQL string and returns a recordset object. Does this mean that a copy of the recordset is returned or is it passed by reference?Obviously this could have a large impact on performance for large recordsets.
SUBROUTINES Vs FUNCTIONS In Asp
There is a chapter on SUBROUTINES, FUNCTIONS AND INCLUDES.what is the difference between SUBROUTINES and FUNCTIONS. If not mistaken, in VB, the SUBROUTINES return no value, but FUNCTIONS do have return value.Variable in ASP: global versus local.variable not in betweeb function is Global (what about subrountine, is it the same) and variable in between function is local, am I right?
Date Functions
I have a column in my SQL server database table by name request_generated_date of datetime datattype and the default value set to it the server date by using the function getdate(). I am querying this table wherein I want to check that when a user submits a form then it should check the following: the submit date (column:request_generated_date in the tabel)should be less than the server date + 24 hours (or one day). When I am writing the query as where request_generated_date ='"&dateadd('d',1,date())&"'" but the result set is empty.Can I use the date() function in ASP or not. or should I try to remove the time factor from the server date and then query the column.
|