Null Values From Recordset

I'm reading records from a recordset and placing them in a table. One of these fields is a date value and I format it using the following:

Code:

<%=FormatDateTime(oRs.Fields.item("DateRecd"), vbShortDate)%>

If this field contains no data, how can I display it without getting an error?

View Replies


ADVERTISEMENT

RecordSet (and GetRows) Is Retrieving Null Values When They Aren't Null

I have an interesting situation that needs to be addressed ASAP.

I am running a standard SQL Query in ASP to retrieve some rows/columns from a table that's on a SQL Server 2000 database. I put the results of that query into a RecordSet, and then use the GetRows function to push the results that are in the recordset into an array variable. In the query that I am running, 39 columns and 2 rows are returned.

The GetRows function appears to be working - the array variable is being created with the proper dimensions. However, the values of the different "cells" of the array are not showing up correctly. The first and the last column values for each row are correct, yet everything else in between is blank, empty, NULL, or whatever.

In other words: ArrayVariable(0,0) shows up correctly, ArrayVariable(38,0) shows up correctly, but everything in between is null.

I did a test on the RecordSet and discovered that it was the culprit - it wasn't being filled in properly. This is strange, though, because the select query that I run in the ASP code to create the recordset returns perfect results when I run it on the SQL Server 2K database.

View Replies View Related

NULL Values In SQL

I have 2 questions about SQL server. First, what should i do about allowing NULL values when designing the database? What difference does it make? And if I disallow NULL values, should i enter default values?

Second, when adding new records to database with recordset.addnew, what SELECT statment, cursor, and lock type should i use?

I've always used "SELECT * FROM Table" and adOpenStatic, and adLockOptimistic. This SELECT statement looks very inefficient to me, but I don't know what else to use.

View Replies View Related

Inserting NULL Values

How do I tell my SQL Server database to insert a NULL value for an empty string. Like if I set a value to null in ASP like this: x = null then it inserts as empty in to the database, how do I get it to insert a reall null value?

View Replies View Related

Checking For Null Values

i have a null value in one of my session variables.

So i tried using this:

if Session.Contents("Department") = "" then
response.write "DEPARTMENT IS NULL"
end if

it doesn't work though.

Session.Contents("Daepartment") = null doesn't work too.
how should i do the checking to check for null values?

View Replies View Related

Empty/Null Values In SPs

My typical code to call an Stored Proc in ASP is as follows ...

View Replies View Related

Inlcude Null Values In Result Set

I'm working with an Access DB, and two tables. This is going to be ported to MS SQL shortly. The tables are category and merchantcategory, and the link is on category.id and merchantcategory.category_id.

*** Category Table ***
id, category
1, apples
2, oranges
3, lemons

*** Merchantcategory Table ***
id, category_id, merchant_id
1, 1, 1
2, 3, 4
3, 3, 19

What I need to do is something like
SELECT category, count(merchant_id) AS merchants
FROM category, merchantcategory
WHERE category.id = merchantcategory.category_id
GROUP BY category
ORDER BY category

But, I need the merchants column to either return 0 or NULL for those categories that do not have an associated merchant. I would like to see something like:

1, 1
2, 0
3, 2

A. Is this possible?

B. If it is, what do I need to do to get the result? I would prefer not to have a bunch of record sets and loops.

View Replies View Related

Problem With Len() Function & Null Values

i've come across a real head-hurter. I'm looping through a recordset and
response.writing it's rows out with no problem except 1 field. The field
type is varchar and contains words like meeting, holiday, etc.

Problem is, I'm trying to render a "n/a" when the field is null as in
LISTING 1 below. My code isn't catching the null values. How can I test for
null values? I could swear I've successfully used the Len() test like below
successfully on similiar null varchar fields, but perhaps not.

Any ideas?

LISTING 1:

If Len(objRS(7)) < 1 Then
xTeamName= "n/a" ' this is problem line
Else
xTeamName = objRS(7)
End If

View Replies View Related

Why Paramater Values Are NULL When Page Is In EXCEL Format?

I have 3 asp pages. The first page (login.asp) takes the parameter values(userid, groupid, locationid and deptid) based on the login (validate using a table). On submit the page params.asp is executed. Here the user has to select the filtering.

Then the page results.asp is executed. When the result is in excel format only the parameter value p_attdate (p_attdate is the value on page params.asp) contains a value.

The value of p_gid(p_gid is a session variable) remain null. BUT when the output is in html format, the parameter value p_gid return the correct value. I want the output to be in excel format but the sql statement is returning the wrong result. Only p_attdate is returning the correct value. I think because p_attdate is a form variable.

Can anyone tell me why value of p_gid is always null when the output is in excel format???

View Replies View Related

Recordset Values

I'm again having trouble putting ASP records INSIDE html link.
Here's the string I put inside Access field:

No room number specified (<a
href='contact.asp?subject=corrections/addition for AASG.info group ID
<%=(Recordset1.Fields.Item('group_id').Value)%>'>update</a>)

but it is not working. The link created in my html output puts out asp
part LITERALLY and does not put the VALUE of the recordset.

This didn't work either:

No room number specified (<a
href="contact.asp?subject=corrections/addition for AASG.info group ID
<%=(Recordset1.Fields.Item('group_id').Value)%>">update</a>

View Replies View Related

Recordset Values

I have a recordset which displays a feild with the initial value of 1, I want to be able to increase the value with whatever numer I choose.if I set antall = antall + 1, It increases with 1 nomather what number you put in, how can I make it work the way I want.

antall = antall + ?

View Replies View Related

Comparing Recordset Values

i have a a SQL stored SP bringing out one recordset, I have a loop reading out all the records, what I would like to do it compare each record to the previous one and if it is the same then do something. I'm having trouble figuring out how to do the comparison as I loop through the records

View Replies View Related

Splitting Values From A Recordset

I have two records pulled from the same field in a table, so it would look like this

NAMES (Field name)
John (forename)
Smith (surname) There will always be 2 records

I need to take both these records and split them into two variables - one for the forename and one for the surname - (I need to insert these values into SQL statement)

Have tried the following code 'firstname' contains both the first and second name.

Code:

View Replies View Related

Most Popular Values In A Recordset

I am trying to soleve the following problem using an asp recordset (connects to sql)
A column in the recordset contains integers between 1 and 5. I am trying to find a way of concluding which integer is the most common, then the second most common, then the third. (In the event of a tie, the higher integer 'wins').

Hence if in the record set there were 5 1s, 4 2s, 7 3s, 1 4 and 5 5s the output would be Most popular = 7, send most popular = 1 and third most popular = 5. I am familiar with rhe recordset objects ie looping through the records etc .

View Replies View Related

Problem Filtering Recordset By Values Held In Array

I am trying to filter a table of users to select only those records
whose roleID matches a value in an array. There could be any number of
IDs held in the array from one to a few hundred. The array is
generated by splitting a comma delimited memo field from a second
table in an Access DB. I can split the memo field OK, I can
response.write its values, but what I now want to do is add a value
from another table to my reponse write loop. Code:

View Replies View Related

Error Type: ADODB.Recordset (0x800A0BADODB.Recordset (0x800A0BCD)

Last week, my shopping cart was still working well until I began getting the following errors 2days ago..

Error Type:

ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
../order/saveorder.asp, line 157

Browser Type:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Page:
GET /main/saveorder.asp

Could you check my code below and let me know what possibly the error is?

View Replies View Related

Form Values With A File - Passing Values

I want to call a recordset so you can edit the details and then obviously pass the parameters onwards into the db. However, the user guide just says this:

To process other fields in the form, use the Form collection of the upload object the same way you would use the Form collection of the Request object. For example, if your form had a text element named UserName, your processing code would include: Code:

View Replies View Related

How To Convert Escape Values In To Actual Values

i need to convert the escape values which are by mistake updated in DB.
example:

this is a sample text string
is updated in DB as
this%20is%20a%20sample%20text%20string

here %20 is the space.

like wise there are many entries for :,'

is there way that i can update all this in a update statement?
or use asp to to update the records?

View Replies View Related

How To Extract Indiviual Values From A Set Of Values

I have a variable SET which has the value Of 1, 2, 3, .., N.

SET=val1, val2, val3, val4, ..., valN

What is the commend or procedure to extract individual values, val1, val2, ...

View Replies View Related

Is Not Null

I have created a table. How do I limit the result of that table to only show the entries that have the "address" filled in. In Access here is the sql coding to acheive the results.

SELECT Dropoffs.City, Dropoffs.StateInitials, Dropoffs.AcceptedItems, Dropoffs.MoreInfo, zipcodes.Address
FROM zipcodes, Dropoffs
WHERE (((zipcodes.Address) Is Not Null));

How do I set this up in my VBSCRIPT page?
Here is my working page so that you can see what I am trying to acheive. When the page comes up you can type 45255 for the zipcode.

View Replies View Related

Not Null Value

I try to select the not null value from the database in column comment.

select s.ques_no, s.task_no, s.goal_no, g.comment from step_tab s, gen_tab g where s.id = g.id and g.comment is not null

But it still return all the null value.

Can anyone please tell me why?

Besides that, why i can't increase the number that i selected from the database.
id_no = rs("id_no")
id_no = cint(id_no") + 1

Why the id_no never increase even i had "+1"?

View Replies View Related

NULL Value?

I might be doing this wrong but I am modifying the body tag depending on what a recordset tells me.

It works fine if the value exist, but if it is returned null then I can't get it to work ...

View Replies View Related

NULL Vs. No Value

I had set up the following 'trouble-shooting' code to determine how a certain value was being 'evaluated' for lack of a better term. The field "status" in this example has no value in it.

<%
status = RS("status")
If isnull(status) Then
response.write("status is null")
end if
if status = "" Then
response.write("status has no value")
end if
%>

The database field 'status' has no value in it. If I run the above trouble-shooting code, the first statement "status is null" will print out. If I remove the first if statement and use the second if statement 'if status = "" ...', the statement will NOT print indicating that the value <> "".

Questions: What is the difference between something not having a value and NULL?

Most importantly, what is the PROPER way to check for a field not having a value in it? In the past I have always checked for a 'no value' using double quotes.

View Replies View Related

Null

I'm using the following code to, firstly erase any old logins the user has. Then to check whether the page has been idle for longer than 30 minutes or not. If it has been idle for longer than 30 mins then the user will be required to input their password again. However it's not working! Code:

View Replies View Related

Recordset Controlled By Another Recordset Within A Loop

I have created a forum, in which I have 3 tables:

1: Table_Forum
2: Threads
3: Replies

I have it at the moment that on the main default.asp there is a recordset that will
display all records within that table, these are a list of forums that will be available.

I have a table that will show the forum name, and the description. This table is then looped using Do while not, now what i need to do is show how many records in the Treads table are related to each forum using asp. Code:

View Replies View Related

Null Number

Microsoft OLE DB Provider for SQL Server (0x80040E2F)
Cannot insert the value NULL into column 'ContactID', table 'ka0506a.ka0506a.contacts'; column does not allow nulls. INSERT fails.
/submitcontact.asp, line 15

What happened is i used to used MS Access and ContactID is an Autonmuber field, and now my connection is set to MS SQL so it's giving me this error, what's causing this error to happen and how can i change it ?

View Replies View Related

How To Check Value Is Null Or Not

how to check any value in asp that it is null or not.

View Replies View Related

When The Field Is Null

I have a condition that will run depending if a field in the database is NULL. It will not run at all, and I tried various way to write it but none works so far

'not working
If assignee = DBNull Then

'not working
If assignee = null Then

'not working
If assignee = "" Then

If I write assignee to the page then the value of assignee will write if it has a value and nothing if it is null.

View Replies View Related

Null Insertion

I have a data entry form. If the user submits the form without entering any data, the record should be inserted with null entries for the respective fields.
But when i execute the INSERT SQL query with these null values, it gives me an error.
This is vat I am doing:

<%
.....
address = request.form("address")
if request.form("Age")= "" then
ageValue=""
.....
.....
%>
I use these values in SQL query
This is the SQL statement when the above is executed
" INSERT INTO tblStatistics (Age,address) VALUES (, aaa)"
Because of no value for age, the query is not gettin executed.
I dont want a 0, I want a nul entry (<null>).
Could someone throw some light on how to set the age field to null?

View Replies View Related

Null: 'replace'

Can someone help with an error? It's a StoreFront store. right after the credit card screen is gives me the error. I get the following:

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'replace' /ssl/SFLib/incGeneral.asp, line 85

--------------------------------------------
84 Function makeInputSafe(str)
85 makeInputSafe=replace(str, "'", "''")
86 End Function
-------------------------------------------

View Replies View Related

Convert Null

i had select the data from the database. The null value are returned.
How can i convert the null value to integer so that i can add some value for it??
Actually i try to use both of this statement but there's nothing come out...when i try to selecte the data in the database, the null value are returned

if rs("max_id") = "NULL" then
id_no = 1
response.write "id_no = " &id_no& "<br>"
end if

and

if rs("max_id") = "" then
id_no = 1
response.write "id_no = " &id_no& "<br>"
end if

View Replies View Related

Null Variable

I am updating a table depending on the user input that could be left blank for the numeric as well as the string field. I am getting an error if I do the following:

Dim a = null

sql = "update country set number =" & a

If I do ... sql = "update country set number = null", it works fine.

How can I use the variable to change the value to null.

View Replies View Related

Null Value Filtering

I have set up a database, myDB, in MS Access. one of my Table, myTable, has columns Col1, Col2, ..., Col10. Depending on some scenarios, I insert some values in some (but not all) of the columns. Now I want to delete those records that their col3 is null or nothing is set.

I used col3= '' and col3=NULL in the below statement
objRS.Open "SELECT * FROM myTable WHERE col3 = '' ", myDB, , , adCmdText

but none of them works.How to delete a record based on Null value filtering?

View Replies View Related







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