Build DB Insert Statement Dynamically - Loop Form Elements
When you submit the form you can see I am trying to get the each row of the form elements into a format such that I can build multiple insert statements. Here is what I am working with:
<%
Dim x
For x = 1 to Request.Form.Count
Response.Write Request.Form.Item(x)
Next
Would I use some type of Mod operator on the value of x to determine my line breaks?
View Replies
ADVERTISEMENT
I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table
records are manipulated to control the permissions. Code:
View Replies
View Related
How at the start of script can I dynamically loop through all Request.form variables and use them ? either name or the value, both is the ideal though.
example.
have a form:
2 textfields. named "text1" and "text2"
In asp I need to dynamically grab this data not knowing that this form had the textfields "text1" and "text2".
ideal print:
name "text1"
value of text 1
name "text2"
value of text2
View Replies
View Related
I have the following piece of code:If RS.EOF or RS.BOF Then
Session("Authenticated") = False
Response.Write "Sorry, your userid or password did not match"
Response.Write "<BR>"
Response.Write " or you have not registerd yet, please register"
Response.Write <a href="default.asp">Clik here
Response.End
Here, I need to build the line (Response.Write <a href="default.asp">Clik
here)
dynamically, so that the html output from asp page
gives us <a href="default.asp">Clik here
View Replies
View Related
what is the correct way to dynamically build a call to a function in asp? i have the name of the function i want to call in a dictionary object, this works to execute the function but the output_value variable does not get set.
functionString = d.Item("create_contract_function_name") 'set variable for
the create contract function name that was retrieved
functionString = "output_value = " & functionString & "(param1, param2)"
Execute functionString
View Replies
View Related
I wrote a sever side form valiation script that loops through the form elements building a string in the process. If you submit the form without filling in any fields you will get the error message in read at form's top. Look how the fields in the error message are completely out of order. Why is this? Code:
View Replies
View Related
I have a form that is dynamically generated since it is populated with values retrieved from a database. The form can of course also be submitted, which is where I run into some problems.
Since I never know in advance what the length of the form (or for that matter what the different elements' names and values) will be I don't know how to write the code in "receive.asp" to retrieve all values from the form correctly without excess use of "request.....".
I shouldn't have to write requests for every single potential element name that is stored in the DB. Please note that the form can sometimes also contain radio buttons and check boxes, even though they are not present in this short example Code:
View Replies
View Related
Is there any way to extract the form elements' value without submitting the form. I want the value of the form element be used in the script written in the same page without submitting the form.
View Replies
View Related
Here is my input box which has the employee id.
<input type=hidden name=empid value=40578>
In my SQL query, I would like to call the value of "empid" textbox in my SQL Query. How can I do this? Code:
View Replies
View Related
My client wants File Uploading in ASP that i can do but the requirement says that i should have one FORM FILE FIELD first to browse the file to upload.
and the moment i click the browse button of first FILE FIELD, a second FILE FIElD is generated beneath it and when the user clicks on the second Browse button it generates the third and this process goes on. Untill the user clicks the upload button to upload all the files.
I know this sounds stupid as it is much easy to provide 5 Form File fields and if user wants more then another five is added on another page, but ti is clients requirement .
I dont know how to dynamically Generate Form FILE FIELD for browsing file to upload AT RUN TIME .
View Replies
View Related
I have a problem with reading data from a form element(s). Instead of using a Type=Submit, I have chosen to use a hyper-link to call a select case structure which adds, edits or deletes a record depending on the contents of the action property.
here is a couple of lines showing two text box's in my form, directly following is the href that passes data to the select statement.
<td><input type="text" name="Desc" id="descid" size="55" /></td> <td><input type="text" name="Units" id="Text1" size="4" /></td> </form>
<td align=right><a href="<%= SCRIPT_NAME %>?action=add&jdate=<%= dDate %>"><img src="Web-add.bmp" alt="Add" width="63" height="25" border="0" /></a></td>
I would like to include the values from the form elements in the action string but have so far drawn blanks. I have attached the full form code.
View Replies
View Related
I asked a question earlier about creating dynamic pages.
I want to know if its possible to create dynamic form elements based on a condition equating to true.
e.g. as you could have dynamic texts when a condition is true.
Could i have dynamic form elements when a condition is true
e.g. response.write(create radio button)
or create combo box etc
or how is it done ?
View Replies
View Related
How can I check to see if a form element exists on a form that has been submited? I have a load of checkboxes called box1 box2 box3 etc. I want to create a loop which gets the value of the box (checked or not), but there is an unknown amount of boxes so I want a loop:
Do While (box(i) exists)
check value
i=i+1
Loop
how do I do this?
View Replies
View Related
Is there something that prevents an if statement from being inside a loop. I keep gettting an error I put an if statement in my loop. Here's my code:
Do While Not categoryRS.EOF
response.write "<a href='away100.asp?playcategory=" & categoryRS("catname") &"&timer="& timer&"'><big><strong>"
if categoryRS("catname")=playcategory then
response.write "<font color='red'>" & categoryRS("catname") & "</font>"
else
response.write categoryRS("catname")
endif
response.write "</strong></big></a> <br>"
'Move to the next row in the lists table
categoryRS.MoveNext
Loop
View Replies
View Related
I need this variable = to a loop statement
Here is my str
form_bcc = Cstr(If Not objRS.EOF Then objRS.MoveFirst Do While Not objRS.EOF objRS.Fields("Email") Response.Write ";" objRS.MoveNext Loop End If)
And help on how to get this to work?
View Replies
View Related
I am trying to create a multi upload image form and I am kinda confused in the database part of it. I have a form with 3 file browser as below (this is just an example):
Code:
View Replies
View Related
I am using ASP to talk to an SQL database. Most of my tables have a primary key named 'ID'. Is there a way to grab the ID of a record in the same line as the INSERT statement?
View Replies
View Related
how can i write an insert whereby.my attributes in Mainshift table is shiftdate, line, shift & description. ShiftDate and Line is the primary key.so i want to insert the shiftdate, from today's date until around 31st Dec 2008 and line i want to do a select distinct statement where i will extract from execmaster table.
for the shift i want it to be a default "2". for the description all is all "working day"can anyone help on how to write an insert statement on this?
View Replies
View Related
I am using simple insert statement that works fine but it doesn't work when you put " ' ", for example "let us" works not " let's us" because of ' sign....
is there anyway user can add anything?
View Replies
View Related
While I can extract the option value from the following:
<Select name='Keystring' MULTIPLE>
<option value='1' name='status'>Pending</option>
.....
</select>
I cannot seem to extract the corresponding 'display' value when I do a
For...Next Loop:
for each keystring in Request.Form("Keystring")
keystring=request("keystring")
Next
How do I aslo get hold of that 'display' value eg 'Pending'...is it
possible?
View Replies
View Related
I have an asp page which runs an update into our mysql database.
The only problem I have is that a user selects a customer from a
dropdown (this is database fed), and I require the selected item to be
loaded into the db.
All I can get in the database is the first part of
their name upto the first space ?
i.e. if the selected item from the dropdown is A B Knowles, the
database entry is 'A'
cust = request.form("customername")
I have tried adding ' " & cust & " ' for the insert statement
What do I need to do to fix this minor glitch.
View Replies
View Related
Can any one tell me what is wrong with this insert statement:
sql = "INSERT INTO Questions (Question,SurveyId,CatId) VALUES ('" & question & "','" & surId & "','" & Sig &"') "
and why when I print it to screen, it shows this:
INSERT INTO Questions (Question,SurveyId,CatId) VALUES 'this si a test','38, 3','');
I have used similar and it works, they are the right values bit wont work..?
View Replies
View Related
I have a asp page that contains link(A href tag) to some other page.When the user clicks on the link ,I want to perform a insert SQL statement and then link it to target page.Is it possible?
View Replies
View Related
I have been working on this problem for a long time and cannot figure out why i am getting a problem. Code:
View Replies
View Related
I have an old web app that ues an Access database and ASP 3.0. I need to build an INSERT statement based on the contents of a form. What is the best way to handle blank text boxes that are submitted with the form?
For example, I collect all my name/value pairs that are submitted with the form like this... Code:
View Replies
View Related
Can somebody check the insert statement i have written?Ofcourse it is giving error.But what i am trying to accomplish here is i want the records to be inserted and then after the records are inserted ,i want it to be sorted and then displayed onto the page.i modified my insert statement to accomplish the same ,but i am sure its totally wrong.
After performing insert..i want to display records in a ascending order..how do i do that?
here is my isnert statement: Code:
View Replies
View Related
Been trying this for over 2 hours now, and I can't seem to figure it out. I tried browsing these forums for any clues but can't find a problem quite like mine.
Dim conn, rs
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database.mdb") & ";"
sql = "INSERT into booking(numid, carNo, workshop, bookDate, bookTime, status) VALUES('"& tempNum &"', '"& carno &"', '"& workShop &"', '"& bookDate &"', '"& bookTime &"', '"& status &"')"
conn.Execute (sql)
I keep getting a "Operation must use an updatable query" error message.
View Replies
View Related
Having a problem with my change password code. It bombs on the INSERT statement.....I get an error stating thier is a syntax error in my insert statement but I can't figure out where. The delete statement works fine and yes all the variables are getting passed. Code:
View Replies
View Related
I am used to SQL Server, no Access, but this one thing has to be done in
Access. Can you tell me if this query will work, based on the syntax?
I am trying create a new row on the database, in one table, and the primary
key is an Autonumber called PersonalID. This is on the second page, which
shows after the personal has filled out some info on the first page, then
submitted the form using POST. Database name is Shape, and table is named
Personal. Code:
View Replies
View Related
i have this error on the regisration page of the website i'm doing.
Microsoft VBScript compilation error '800a0409'
Unterminated string constant
/Shop/register_process_corp.asp, line 40
SQL = "INSERT INTO
------------------^
Code:
View Replies
View Related
The block of code below shows how I am inserting field values into my dbase table:
strSQLStatement = "INSERT INTO tblArticles
(handid,ArticleDate,sport,articleheader, fpick,articleText) "_
& "SELECT '" & handid & "' As handid, '" _
& ArticleDate & "' As ArticleDate, '" _
& sport & " As sport, " _
& articleheader & "' As articleheader, '" _
& fpick & "' As fpick, '" _
& articleText & "' As articleText;"
Conn.Execute(strSQLStatement)
but I am getting an "Insert statement contains fewer items than the insert list" error , when in fact I am not (both 6 field names).
View Replies
View Related
How can i get the autonumber(primary key value) from the specific rows when i just insert it.Example
i just insert the member information.
sql="INSERT IMTO register(user,password,address) VALUES (shujuan,841218,singapore)"
so how can i get the autonumber value for this row after i just create it.
View Replies
View Related
Three tables: Registration, Session, Payment: Joined with 1 to many rel. starting with registration, moving to session and ending with payment.
Form 1: Registration= INSERT INTO statement works fine. Reg table now has fields populated with form data.
Form 2: Session= <<<<<this is where the problem occurs>>>>>
Form 3: <<<<<<problem as well>>>>>>
When i want to do another INSERT INTO statement, I have to know the RegID from the earlier table join(registration). Of course, I can't run either Form 2 or Form 3 without knowing the RegID from the Registration table begin point.
I don't know how to increment the RegID as a foreign key in a joined table over the internet. Using Access over the network it's real easy to pass the foreign keys and the design seems to be more flexible this way, but I need to update tables and present stored data to the user across the internet.
View Replies
View Related