Array Not Created Properly With Split Function

I am having trouble loading the result of a VBscript split function into an array. The script is supposed to take the user's login name (the form for this is name separated by underscores such as john_foo or lisa_wilson), split it at the underscores, and load first, middle and last name into an array. The problem I keep getting though, is that I am getting a type mismatch error. Here is the code:

<%dim LogName, NameArray(), FirstName, LastName, MiddleName, LastPage
'Get NT authorized login info
LogName = request.servervariables("logon_user")
NameArray = Split(LogName, "_")
for x = 0 to UBound(NameArray)
response.write NameArray(x) & "<br>"
next
%>

The FirstName, MiddleName, LastName vars are supposed to take the array values later.

View Replies


ADVERTISEMENT

Split Function To Split First Letters

I have a variable which holds college names

strcollege="University of California"

i want a variable to save UoC

what i meant was there are 3 words University of California

so i want the first letter in each word to be stored in a variable ....

View Replies View Related

Split Array But On Every Second Split?

I have a string

212334||327362737||437437||47347837||8347834||

etc

but i want to enter them into a databse

but it must be as 1356235 then field 2 is 125662

dont know if this makes sense

each number is a team in a match so team 1 plays team 2, enters into databse
then move on to the next 2, in that array.

i cant seem to get it to do 2 at a time, without ending up with an endless loop or team 2 being team 1 on the second entry.

View Replies View Related

Split An Array

How can I split an array to string?

View Replies View Related

Array And Split?

i have a text box, where i want to be able to enter items on a one per line basis.

i then need to insert these items into a database.
i have the functionality to insert into the db ...

View Replies View Related

How To Add Click Function To A Dynamically Created Button In WebFormapplication?

I am trying to create a bookstore WebApplication using c#. I can
display the books (obtained from sql server) on a table in a WebForm.
At the end of each row, I would like to add "add to cart" button.
Therefore, I use

Button bt_add = new Button();
bt_add.Text = "Add to cart";

and put it in a cell which is later placed in each table row. The
Buttons display fine on the WebForm. However, I don't know how to add
the Button_Click function for each of the Button I created since I don't
know the total number of books in advance. Can anyone help me get "add
to cart" button to work?

Note: I try clicking on each Button, the WebForm page loads back to its
original stage (Page_Load function) and my search result is gone.

View Replies View Related

Repopulating Checkboxes From Split Array

I am developing this web application where users may go through a number of steps to "build their product". This is all done with session variables to hold the input until submitted. The way I have it right now,

There is about 16 checkboxes, all with the same name "checkbox" (for simplicity) Each has a different id and different value.

The user may only choose 3. The values from these get stored in a comma deliminated string: ie. about, testimonies, services.

(I am trying to avoid setting a variable for each checkbox to be equal to, which I tried and it didn't work.)

If the user goes back to the page if they change their mind I want the appropriate checkboxes to be checked.

Right now I have the string being split up into an array. I have tried setting the array values to variables, then I tried setting these equal to another specific variable only for that checkbox..blah,blah, blah.

Here is my code, very similar to someone's on the forums (which I have been going through with a fine tooth comb, ; turns out their thread was never answered).

This code gets the first array item and checks the right checkbox but no the other 2.

<%
menuarray = Split(Session("checkbox"),",")
for i = LBound(menuarray) to UBound(menuarray)
'currentCardType = ""
response.write " " & i & " = " & menuarray(i) & "<br>"
next

' because there is only 3 for sure, I just used 0-2 rather than i for the following.
' I have the following three times in my code, for the 3. Tried it with just "i" and within the loop but didn't work

if CStr(menuarray(0)) = CStr("Welcome") then
vWelcome = "checked"
elseif CStr(menuarray(0)) = CStr("About Us") then
vAbout = "checked"
elseif CStr(menuarray(0)) = CStr("Message from the President") then
vMessage = "checked"
elseif CStr(menuarray(0)) = CStr("Products and Services") then
vProducts = "checked"
elseif CStr(menuarray(0)) = CStr("Our Services") then
vServices = "checked"
elseif CStr(menuarray(0)) = CStr("Curriculum") then
vCurriculum = "checked"
elseif CStr(menuarray(0)) = CStr("Testimonials") then
vTestimonials = "checked"
elseif CStr(menuarray(0)) = CStr("Student Life") then
vStudentlife = "checked"
elseif CStr(menuarray(0)) = CStr("Apply Now") then
vApply = "checked"
elseif CStr(menuarray(0)) = CStr("Case Studies") then
vCasestudies = "checked"
elseif CStr(menuarray(0)) = CStr("Catalog") then
vCatalog = "checked"
end if


.....

View Replies View Related

Image Array Split Into Different Pages

I'm developing a site in which I'm supposed to daily display an array of images into a table in a page. The question is : Is there any code in asp that could help me perform the splitting of the array and consequently displaying it in the tables along the pages, (considering the necessity of displaying it in more than one page) ,automatically ? The problem is that these arrays of images do not have a constant length, actually, I can read the content of items in a certain folder, before creating the array and, according to that number I should set it to be splitted in "x" pieces that should be displayed in "x" pages, within tables. If it was a fixed number of items I wouldn't have much trouble, but this number varies, daily.

View Replies View Related

Split Array Evenly Into More Arrays

arrContents = Split(strContents, vbCrLf)
but now i want to divide the contents of "arrContents" evenly and randomly into 6 other arrays.

How can i go about doing this?

View Replies View Related

Split() Into Array() Type Mismatch Error

I am retrieving a set of values from some checkboxes in a form. When I put the values into a variable it prints fine:

Code: .....

View Replies View Related

Split Function

I want to take a server variable and split it. It would look something like this:

varServerVariable = fistname.lastname

I want it to look something like:

first = firstname
last = lastname

I know that I need to use the Split Function, but I'm not sure of the syntax.

View Replies View Related

Split A Function

I have a textbox that will have this kind of value.
eg. 1+1, 1+2, 1 +2, 1 + 2.....

So now i need to get the 1 and 2 to add it up. This textbox is for add function.

Before this i using the Mid Function. But this is only work if they entered btwn 1 - 9. If 10 then unable to find it.

I remember there is a function where it will find the value then stop at there. then i only grab the bfore the value. I try to lookup but i can't find the function. I need to get the value bfore + and after + to add it up.

View Replies View Related

How To Split Tables By Using Sub Function?

What I am doing is:

If Term = Spring2005 then display everything belongs to Spring2005

If Term = Fall2005 then display everything belongs to Fall2005

And so on.

I used Sub function to do that, but it doesn’t split it? How can we do that?

Code:

View Replies View Related

Split Function Problem

User enters a string of words and it's stored in txtHAR.

I then do this,
txtArray = split(txtHAR," ")

After this step i'm lost. Because user can enter as many words as they want how am i to track the number of words txtHAR has split into?

View Replies View Related

Split And Ubound Function

this code gives me one short of the ubound function, what is wrong?

e.g if i have 353425432,325423,2542354
it gives me 2 instead of 3

jumvar = request.QueryString("one")
jumvarsplt = split(jumvar,",")
valnum = CInt(ubound(jumvarsplt))

View Replies View Related

Split Function & Loop

I am trying to loop around a split and the code I have is below:

response.Write("<tr>")
    response.Write("<td class=""tableHeader"" valign=""top"">Keywords</td>")
    keywordsSplits = Split (keywords, ", ")
    For each keywordsSplit in keywordsSplits
        response.Write("<td>")
        response.Write(keywordsSplit)
        response.Write("</td>")
    Next
response.Write("</tr>")

The problem is that it does actually put the seperate keywords into seperate cells (td's)
I get the following:

<tr>
    <td class="tableHeader" valign="top">Keywords</td>
    <td>test test1 test2 test3</td>
</tr>

I actually want

<tr>
    <td class="tableHeader" valign="top">Keywords</td>
    <td>test</td>
    <td>test 1</td>
    <td>test 2</td>
    <td>test 3</td>
</tr>

Can anyone help?

View Replies View Related

How To Use Split Function In SQL Line?

i want to use split function in sql line ....

View Replies View Related

Split Function, Check If There Is A Space

I'm using the split function to split forename and surname, but sometimes there is no second name, is there any way of doing a check to see if there is a second part in the array?

this is the split:-
WordArray = Split(strUsername, " ")

View Replies View Related

How Do I Highlight A Split Function Text?

How do I highlight a split function text?

code ....

View Replies View Related

Split Function To Use XMLHTTP To HTML

Basically I am using XMLHTTP to pull a file ( template ) then I am using replace to replace tags i.e. [code] with a HTML equiv.

So now I need to know how I can split [Menu|http://localhost/root3/cgi-bin/templates/menu.asp?Top] so that I can use XMLHTTP to pull that file and output it as HTML.

I know how to split a string, but I can't call this [Menu|http://localhost/root3/cgi-bin/templates/menu.asp?Top] as a variable as it can change at any time.

p.s I mean how Sitepoint does the url replacement, it will have a replace function that will first search for URL and then convert what ever is after the = into a url, then what ever is after that as the name.

[-URL=http://]test[/-URL] ( I put -'s in to stop the replacement )

View Replies View Related

Split Function And Multiple Select Drop Down

I have a multiple select drop down. It will load into it the following information: Student ID, Last Name, First Name

There will be another drop down box that loads with classes, only this is not a multiple select.

I need the user to be able to select all students they need from the first drop down and then select the class they want to insert them into. Then, when they hit the button, it will break up the data from the first, Student ID, Last Name, First Name and insert those three things into the database under those respective column names.

Does anybody know how I can split these up properly when there will be multiple students selected, or does anybody have a better way of doing this?

View Replies View Related

Using Vbscript "SPLIT" Function On Multi-select Field

I am trying to split a mgrgroup field to extract the MD codes. It correctly grabs the MD codes if all records in a mass update are updated, but if only one record in the loop is updated then it puts the last 5 digits of the mgr name in the MD field.

THIS IS THE CODE: ....

View Replies View Related

Using Vbscript "SPLIT" Function On Multi-select Field

I am using the following code to split/join values in a multi-select field. It is combining all the values in All the records into one long string in each record in recordset.

Example: I have a recordset with 2 records. The 1st contains the split/joined values: Alan Smir, Jeff Karl The 2nd contains the value: Keith Robb

When it updates database, it will put Alan Smir, Jeff Karl, Keith Robb into each record in the recordset. Instead it should be putting Alan Smir, Jeff Karl into the 1st record
and Keith Robb into the 2nd record in the recordset.

Does anyone see what is wrong with the code ....

View Replies View Related

VB Function To Return Array To ASP

I need a VB function to return array of collections like

Private Type Employee
empname as string
address as string
salary as integer
deptno as integer
End Type

dim employees() as Employee

Public Function getEmployees() as Employee()
getEmployees=employees
End Function

I will call that function in ASP.This was not working any other method is welcomed.

View Replies View Related

XML Not Output Properly

I created an RSS script for my readers to use, but I have been having some minor issues with it.

Actuallyit works fine and I have tested it in 3 feed readers without a problem. Still it does not output as perfect XML if you go here you will see what I mean. Code:

View Replies View Related

Do Until Not Functioning Properly

The basic gist of this is that it makes downloading of podcast's available (currently) all the time. However I need it to make them available if and only if the date is the day after the podcast is recorded.

Currently the site is making them available the day before they're actually ready. How can I code this so that the asp page knows that the podcast should be available only on the day it is actually ready? Code:

View Replies View Related

Checkboxes Not Properly Writing To DB

All i want to do is have a form with 17 checkboxes that writes a value to the database. At this point I don't even care, true/false this/that 1/0 whatever! Setting the Access Database fields to yes/no was not working even 1 bit in the least. They would all be set to off no matter what.

Changed it to text and inserting "That" for off and "This" for on, it comes up, but does it all funky, not in order, all "That"'s at the top, all "This"'s at the bottom, and not even in their respective fields. Code:

View Replies View Related

HTTP_REFERER Does Not Work Properly

Pretty simple task ... page1.asp calls page2.asp and I want page2.asp to show the HTTP_REFERER (which I expect to be page1.asp).

It's blank when I try from my local machine and from other machines. HTTP_HOST, URL and various other server variables work fine so there is a work around, but I'd like to know why HTTP_REFERER doesn't seem to work

View Replies View Related

Numbers Are Not Being Displayed Properly

I am unable to get this function to output the correct output. The Subtotal works fine, but the GST and TOTAL are not working properly. GST only shows the integer value and nothing after the decimal places. Code:

View Replies View Related

Can't Get Field To Populate Properly

I am using what seems to be a fairly simple calendar program that is ASP. I have been successful in adding fields to this App, but for some reason, I must be missing something because when I go into the program to edit an entry, one of the value's (Location) doesn't populate properly.

It pulls up the LAST option (Other) within that dropdown field, instead of the one that had previously been selected. I'm not sure what I've missed, but could someone help? Here is a portion of the code: (let me know if you need additional info). Code:

View Replies View Related

How Can I Compare These Values Properly?

I have a number value in database and same number value from form. For some reason these are not equal. How can I compare these properly? Code:

View Replies View Related

Loop Of 20,000 Executes Properly

I've got a mailing list script which loops through up to 20,000 database records, and fires a customised email out to each via the bulk mail queing function of JMail Pro (email component).

Never having tested this with anything other than 100 records, I'm very wary about executing the script in case it times out or starts to misfire.Is there anything anyone can recommend to make sure this process goes smoothly, perhaps even giving the user feedback whilst it's executing e.g. "sending messages 1-1000", "1001-2000" etc?

View Replies View Related

ASP File Don't Load Properly Off Computer

When I try to open an aspx file located on my computer it doesn't load properly (i.e not all objects are visible like text fields and such) and it gives me a syntax error stating that it expected a semi-colon (;) on one of the lines.

My page language is VB and so no semi-colon is required and when I load the file through my web server by typing
http://myIPaddress/myfile.apsx
the page loads correctly and functions normally.

Several hard drive formats ago I was able to open aspx files with internet explorer without going through my web server. I am pretty sure I have everything installed like IIS 5.1 and the .NET framework.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved