ASP If Database Field Blank - Do Nothing!
what i am trying to do is when the database field is empty to not display the box (table) that is in my css file, whereas when there's something in the field i would like the box to display!!! So i'm basically trying to get a 'when field empy, do nothing!!! my code at present generates the box no matter whether the field is full or not!!! Code:
View Replies
ADVERTISEMENT
I have a page that processes a form and one of the fields might be empty as it's optional if it gets selected or not.
In my process page I would like to check if the form field news_image is empty or not.
How would I do this?
<% If Request.Form("news_image") = "" Then %>
Is that how you do it?
View Replies
View Related
I' m getting a (0x80040E2F) error, if I submit my form, with blank textboxes
to my update stored procedure. The stored procedure expect values, so how
can I detect if a form field was empty. I've tried testing to see if the
form field is null, blank and to count the characters, but I can't get it
working. My SQL table allows nulls, so it's not that.
View Replies
View Related
I have a dynamicaly drop down the problem is that it places a blank in the first position I need for it to only display the values returned Code:
View Replies
View Related
I set up a form, asp code for the form, and an access db to store the data. It all works fine. The only problem is that I want to set up an error message that reads something like "Please fill in the blank field and then resubmit". Code:
View Replies
View Related
How do I change a blank database entry, so when I retrieve it blank I output a string say <i>N/A</i> into a table? Currently I have an if/elseif/else like this.Code:
if tf.name = "ID" then
Response.write(bla bla)
else if tf.value = null then
Response.write(bla bla)
else
Response.write(bla bla)
end if
*Note, where the word null is, I have also used the string "" and it still does not work.
View Replies
View Related
When rs("firstname") is called on my page,
it returns the first name and a blank space before it.
I want to pass it throught the QueryString,
but URL's can't have blank spaces.
On my DB (Access), the none of the firstnames have any spaces in front of them.
Any ideas?
View Replies
View Related
When a file is uploaded, notifications go out to Admins. Currently Admins have the ability to have 3 email addresses that the notification can be sent to.
Now lets say they only have 1 email address for a contact. When I run the code below, it cycles through to everyone that needs to be contacted and sends email to all 3 addresses.....BUT #2 & #3 are empty and then in my SMTP folder I receive a bunch of files in the badmail folder.
I need to correct this so that I can eliminate having to go and purge on a daily basis.
Now I am sure that there is a better way of doing this... I inherited this and am looking for some help with correcting this....
View Replies
View Related
I'm trying to upload the entire field for every recordset to . How could I do this? Here's what I got so far.
<!--#include file="searchconn.asp"-->
<%
UPDATE SearchTable SET SearchTable.newscontent = " ";
%>
View Replies
View Related
I have an access database with year designations for field names, such 2005 2004 2003 ... and data corresponding thereto. I can formulate a query in MSAccess and it works just fine. However, I am trying to create a web page that will create a database
connection and use SQL to create a recordset(s) which I can then manipulate in vbScript.
The problem seems to be structuring a query that will work in
vbScript. I have tried several combinations:
rs2.Open "SELECT 2005,2004,2003 FROM Table", conn, adOpenStatic, adLockOptimistic
rs2.Open "SELECT '2005','2004','2003' FROM Table", conn, adOpenStatic, adLockOptimistic
rs2.Open "SELECT "2005","2004","2003" FROM Table", conn, adOpenStatic, adLockOptimistic
but none of these will extract data.
I have also tried casting these numbers to strings in a string variable, but still no success.
Is there some naming convention I am violating by simply using year designations as field names or is there a problem with vbScript?
View Replies
View Related
I pass a table name into my program dynamically. I could display the data by looping through the object.Fields for both the field name and the field data using object.GetRows.
What I have not figured out is if there is a way to figure out from the Fields what type of field (ie. Numeric, Text) it is.
Certainly I could check the actual data once it is read, but is there a way to figure out the field type without doing that? Perhaps an object property of a recordset that I am not familiar with?
View Replies
View Related
I have an asp page that has a function that connects to an Access database.
I am using Javascript. Is there any way to reference the field name in the
database through a variable in a sql statement? Code:
View Replies
View Related
I have a "csv file" as a database.
The 1st row contains the field names:
Orion.Accounts.AccountName,Orion.Accounts.Address1
the code I use normally works:
<%=rs("Orion.Accounts.AccountName")%>
Although in this case is doesn't because the fieldnames contain full stops.
how to modify this line:
<%=rs("Orion.Accounts.AccountName")%>
View Replies
View Related
I'm having a spot of trouble trying to update fields in a access database using asp. I can delete and add fields thru the asp page but when i attempt to modify the fields i get a page not found error message. Code:
View Replies
View Related
im trying to increase the value of an id key in my database by 1 each time i add a new record. is ther anyway i can do it using ASP?
View Replies
View Related
I want to search 2 of my database fields (title and description) for search terms entered in a form. I can do a 'LIKE' but how do I cover searching for each word in the string that has been submitted? For example, if someone searches for 'World Cup Final', I want to search both database fields for 'world', 'cup' and 'final'.
View Replies
View Related
I have a form that inserts a student's course choices into an Access db. The student can choose from 4 options in a day. From a drop down box that is populated from the db.
Each course has a field called count1, count2, count3 and count4 which are the class sizes for those sessions. When they choose a session, I have a bit of ASP that takes '1' away from the count.
However, I need to validate the form when it is submitted so that if course = 0 a message pops up to say the course in that session is full. At the moment, the drop down boxes are populated by SQL that says only show if count>0 but if a lot of students load the page at the same time they can all subscribe to it - so I am getting -4 in some sessions. I need to check whether the course in that option is full i.e. '0' when the form is validated and then for it to tell them that that particular session is full.
View Replies
View Related
I am trying to take a name that is in a database field and rearrange it to place it in a session variable. For example:
Database Field:
SMITH, JOHN
What I would like to see:
JOHN SMITH
Instead of - Welcome SMITH, JOHN
I would prefer - Welcome JOHN SMITH
Can this be done when requesting a form variable or does it have to be done when viewing the recordset variable.
View Replies
View Related
I am trying to determine if a field in a database is empty or not. The code I have is this....
(before this I have code that opens up the database, gets the data from the table. the var "content" holds the data if any from the database.)
if content = "" then
alert1 = "content field is empty"
else
alert1 = "content field contains text"
end if
This doesn't seem to work. I also tried...
if (content) then
alert1 = "content field is empty"
else
alert1 = "content field contains text"
end if
No luck yet. Any ideas?
View Replies
View Related
I'm trying to post a value from a form field into a database field of type Date/Time formated to short date.
Even though the value from the form comes in short date style ie 19/06/2004 I'm getting a type mismatch error
View Replies
View Related
I have an ASP variable called IRNvar:
If IRNvar(0,num) = "True" then
IRNvar(0,num) = 1
else
IRNvar(0,num) = 0
end if
In my sql database I have a True/False field called VariantFlag which is a bit data type. The IRNvar value is numeric. I am trying to insert the 1 or 0 into the database so that the field shows true or false accordingly but I get a 'Type Mismatch' error. Here's the insert statement:
SQL = "INSERT INTO Documents (CNID, DocumentPrefix, DocCategory, DocumentName, VariantFlag, PartNo, PartDesc, NewIssue, StatusID) VALUES ('" & CNID & "', '" & IRNprefix & "', '" & IRNcat & "', '" & IRNnumber & "', " & IRNvar & ", '" & PartNum & "', '" & IRNDesc(0,num) & "', 'A', '5')"
Is there a way to convert the number to the right data type? Am I doing something wrong? I'm quite new to all this so it's probably something silly.
View Replies
View Related
I have an access database with lots of fields including a memo field called
'priecinfo'.
Everything works well, lots of data is written, but in one particular
situation, I can't get the field 'priceinfo' to write out:
1) the code below works properly except that the field 'priceinfo' doesn't
get written - replace it with any other field and it works. Code:
View Replies
View Related
I have the following line of code that is part of a form that displays a record from a database;
<textarea name="name" cols="60" rows="20" value="<% =rscms_example("body") %>" </textarea>
Could you please tell me where I am going wrong on it? I know its probably very simple, but I am terrible at forms anyway.
View Replies
View Related
My question is this: how do I get a value from a listbox to assign to a variable (elementary I know)? Code:
View Replies
View Related
I need to validate an item number from a form field against a MS SQL database
I am using a 2 page process to print barcodes from an entered item number on page 1 and need to only use valid item numbers from the database. If they enter a wrong number I want to give them a page telling them of the error.
I have 32 fields on page 1 to enter 32 items.(one for every label on the second page that contains the barcodes. Here is the connection to the database that I am using for the barcode.(Column IMLITM contains the item numbers) Code:
View Replies
View Related
Trying to update 2 fields. my database is read only..
Microsoft JET Database Engine error '80040e09'
Cannot update. Database or object is read-only.
/sendd.asp, line 16
this is line 16: rsAddComments.AddNew
is this something to do with my server directory permissions?
code .....
View Replies
View Related
I currently have a web page that pulls in job vacancies from a search form all written in asp and the database is in access. I will be placing an extra field which will say "apply now" and on selecting this you will be taken to a new page where you can fill in your details and email them to the employer.
My problem is I need to know how to get a field in the form that will automatically fill in the title of the vacancy being applied for from the database.
View Replies
View Related
I am pulling legislation information and expiry dates from an access database and posting to the web. The expiry dates in access are formatted as Month Day, Year (EG.. January 1, 2006) But when they are pulled from the database to the web, they come out as 01/01/06. I know that the format we have in access is simply a mask, however we require that format be carried through.
This is likely a simple solution, however I am new to ASP and can't seem to locate any information on this. I have searched the forum for related info on this but can't find anything that relates to my specific situation.
Here's the code we are using so far...
Code:
<%
Do While NOT Recordset.Eof 'i.e. carry on looping through while there are records
Response.write "<tr><td>"'open row and first cell
Response.write Recordset("Legislation")
Response.write "</td>"'close first cell
Response.write "<td>"'open second cell
Response.write Recordset("Repealed")
Response.write " "
Response.write Recordset("Expiry_Date")
Response.write "</td></tr>" 'close row
Recordset.MoveNext 'move on to the next record
Loop
%>
I have also found and implemented the following code:
Code:
dt=recordset("Expiry_date")
dt=Month(dt)&"/"&day(dt)&"/"&year(dt)
response.write(dt)
This lets me change the positions of the numbers, but I can't figure out how to make it display the full month name and full year.
View Replies
View Related
Is it possible to insert more than 2 checkbox values into 1 field in the SQL database?
I have 5 checkboxes; I would like to insert them all into 1 column in the SQL DB.
If I insert more than 2, it gives an error.
View Replies
View Related
How to search a database field from form input? is it easy to do i like to have a html form from an html page that will call an asp page to do db search, if user enter a zipcode that match in the database it will pull all the infomation from both talbes and display on the screen
i have 2 tables related to each other
contact table
id, fname, lastname, contactid, email
zip table
id, zip, contactid, city
View Replies
View Related
How to search a database field from form input? is it easy to do i like to have a html form from an html page that will call an asp page to do db search, if user enter a zipcode that match in the database it will pull all the infomation from both talbes and display on the screen
i have 2 tables related to each other:
contact table id, fname, lastname, contactid, email
zip table
id, zip, contactid, city
View Replies
View Related
I have been provided with a DSN, user name and password for one of my
clients sites.
I'm not an ASP developer and need to view all the contents of this database.
I usually work in PHP but only have ASP available on this server.
I want to open the database and simply output all the contents into a HTML
page.
View Replies
View Related
I would like to create a page of hyperlinks that are constructed from the contents of a database field. When the user clicks the link they are taken to a page that will display all fields from that particular record.
I already have the page structures in place. There are two pages, one with the links and the other to display the record. Code:
View Replies
View Related