Inserting NULL Value
How to do subj ?I tried:
date1=NULL
strSQL = "INSERT t (mydate) VALUES("&date1&")"
i tried with ' ' and without, tried "''", i tried allmost all variations &because i cant put NULL, i have error in my main strSQL.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Inserting Date As Null
i found a different way to insert the date or rather not insert the date at all if a certain condition is true. But anyway i have come accross the same problem when i try to update the date field with a blank value. Code:
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?
Inserting Null Valuye
I'm working on an element of my site in which users can choose an expiry date for features they create. However, i also want them to have the option to set the feature to be active indefenitely. Currently I am making them choose to add a date/time field to the record, or leave the value of the field as Null. The problem I have here is that if they choose the keep the feature active indefenitely, I need to keep the date/time field a NULL. However, if they change thier minds and give it an expiry date, and then want to change it back, I have a problem as the field has been populated. If I try to enter a "" value into the date/time field, but when the user goes back to edit they get a 01/01/1900 date instead of N/A. Trying to make it have a far future date also doesn't work, as when they go back to change they get the year as 01/01/3000 or some such. Basically, what I want to do is add a NULL value again to the date/time field. Can this be done?
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.
Null Value
I am trying to update an integer field in an Access database with a null value (ie, make the field empty). It currently has an integer in it. Here's the code I've tried, which normally works for all other updates: set rs = Server.CreateObject("ADODB.Recordset") rs.ActiveConnection = sConnString rs.Source = "SELECT * FROM tblFixtures WHERE FixtureID = " & strFixtureIDcurrent rs.CursorType = 0 rs.CursorLocation = 2 rs.LockType = 3 rs.Open() rs_numRows = 0 rs("ArticleID") = "" rs("Result") = "" rs.update rs.close set rs = nothing However I am getting a Type Mismatch error on the rs("ArticleID") = "" line. Where have I gone wrong?
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.
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"?
Null Value
What's the best way to handle passing a null value to a number field in my Access database? Right now I am getting an INSERT INTO error when I am doing this. I tried doing the following: Mon = Replace(Request.form("txtNewMon"),"","0") but it doesn't seem to work. Would you suggest doing an IF satement?
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 ...
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.
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:
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.
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?
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
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.
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.
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?
Null Date
I am new to using the filter property. When I try publishDate = '' I get a type mismatch error
NULL In If Then Statement
Code: <img src="/images/thumbs/<% IF rsListProduct("AHFC_Product_ThumbURL") = null THEN %> no_image.gif <%ELSE%><%=rsListProduct("AHFC_Product_ThumbURL")%><%END IF%>" width=50 border=0> Why does this not work? Field is for SURE null in DB if no image uploaded.
Check For Null
Is there an easier way to check if any of the fields returned in a select statement have null values? After running this command: set rs = conn.execute("select A,B,C,D,E,F,G,H,I,J from SomeTable where...") I could check each field this way: If IsNull(rs("A") Then Response.Write("The value of A is null") Else Response.Write("The value of A is " & rs("A")) End If If IsNull(rs("B") Then Response.Write("The value of B is null") Else Response.Write("The value of B is " & rs("B")) End If If IsNull(rs("C") Then Response.Write("The value of C is null") Else Response.Write("The value of C is " & rs("C")) End If etc. But is there a simpler way? Also, my "solution" probably wouldn't work if more than one recordset was returned...
LOGON_USER Becomes Null
I create a web site in a Windows 2003 server/IIS6, and I used asp pages to get ServerVariables. After I set FrontPage Extension 2002, some ServerVariables like LOGON_USER become null. Any body has an idea?
Best Way To Find <> NULL
How do I go about testing to see if a value is not equal to NULL? isNULL provides the opposite functionality, but all my attempts at the former return a FALSE value.
My.mind = Null
I have an add page, sending data too an access database, and what I want to do is, if their is a Null value (for example a user forgets to write in a name) then users will be redirected to a page called "wrong.asp" the following are the add pages, the info is put in through add.asp, and sent through add1.asp. Add.asp is pritty big because there are 3 dynamic drop down lists, (D1, D2, D3) Code:
Update Value Null
I would like to update a field with the value of a "empty check box". The problem that my numeral field (kom1) in the db will be emty, instead of 0. I need the value 0 becaus it's used by a SUM in an query.
'is Null Or Not An Object'
I'm writing an application, and now an error message always pops up showing that one of the variable 'is null or not an object' I wish to know what is the possible cause of this error message. I've defined the variable at the beginning of the program. So it there anything to do with the variable fail to get value from the form. The variable is the 'select' name of a drop down list.
Invalid Use Of Null
Is there anything wrong with this query. Sometime it works sometime it doesn't.Code: SELECT SUM(A) AS sum FROM Table WHERE XX <> '' Most of the time when it don't, this will be the error: "Invalid use of Null"
Detecting Null
At the moment i am checking that all the fields have been filled out, at the moment i am using the following... if firstname = "" and surname = "" and address1 = "" and town = "" and county = "" and country = "" and postcode = "" and phone = "" and email11 = "" and email2 = "" and password1 = "" and password2 = "" then is there a better more efficient way of doing this?
Handle Null Value
I've tried inserting this code, but it doen't work. I guess it must be something to do with the byVal keyword used in the constructor for the function? Code: 'Handle a Null date If (strDate = "" ) Or (Len(strDate) < 1) Or (strDate = Null) Then fncFmtDate = "N/A" Exit Function End If
Login Null
My web server is a Windows 2k Server and my database server a Windows 2003. I use windows authentication to login at SQL Server, but when I access from a client machine that uses Win 2k Professional I always receive this message: "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.". When I access from a client machine that uses Windows XP everything it´s ok. This problem only occurs at the web site. When I try to access the Query Analyzer or the Enterprise Manager I still have the connection.
Update A NULL Value
I would like to update a NULL value in "LEDef _Champ1" of the table "dbo.LEDef " Here is the asp code : objUpdateModule.CommandText = "UPDATE dbo.LEDef SET LEDef _Champ1=xxxxxxx WHERE LEDef_PK=1245 objUpdateModule.CommandType=adCmdText objUpdateModule.Execute Could you tell me what I have to put instead of "=xxxxxxx"
A Insert Null
Imagine This Case *** Id_down Numeric(2) Can Be Null *** Which One Is Ok ? Op1) '"& Null &"' Op2) "& Nul &" Op3) Just Nothing So ?
Invalid Use Of Null
cart_calc_shipping_cost = (Rs.Fields("InitialCost")+(round((Weight/1000)+0.5)-1) * Rs.Fields("AdditionalCost")) Seems to give me this error: Microsoft VBScript runtime error '800a005e' Invalid use of Null: 'round' I think it is to do with the value of weight, however weight does have to be sometimes 0 so how can i fix this?
Is Null Problem
I have came across a problem in my Client Update form. The form gets the users details from the database and displays them in the relevant fields. I have noticed that if the contents in the telephone field are removed then when they upate it doesnt allow the update. So i assume that there MUST be some sort of numerical number in the telephone field. Code:
Insert Null Value
I have a form where the user inserts data. The DB is access and the table is made up of 15 columns. 5 of them are not text. The columns that aren't text if the user leaves them blank it won't insert. 2 are dates, 2 are currency, and 1 is a number. All these columns are defined as NOT required this doesn't make and sense to me. This is part of the code. Code:
Request Is Null
<a href="#" onclick="javascript:if (checkFields()) {document.action='newPage.asp?insert=1&action=par';document.finsert.submit();}"><img src="myPic.gif" border="0"></a> Why Request("insert") is 1, as I expect, but Request("action") is NULL? What's wrong with it?
Showing Only Null Fields
What to only show the Null fields on an ASP Update form. eg. <% If "Recordset1.Fields.Item("B15-1").Value" = IsNull then %><input type="text" name="B151" value="<%=(Recordset1.Fields.Item("B15-1").Value)%>" size="32"> ...etc get what i mean? Needs to be per field - as the exact fields will differ from record to record Any ideas?
Join() And Array With Null
I recently learned of Join response.write join(ThisArray," ") I am having trouble with it, however and it appears to be caused by null characters. Is there anyway around this join problem with Arrays containing Null?
Handling Null Data
The chunk of code:Code: c1 = rs1.fields("field1").value If c1 = null then response.write "no data" else c1 = replace(c1, "'","'") c1 = cint(c1)error '800a005e' Invalid use of Null: 'replace' this mean that eventhough the data is null, it ignores the 1st condition of the IF
Pass Null Into Function
Code: Function FixString(s) If Not IsNull(FixString(s)) then Fixstring = Replace(s, "'", "''") end if End Function error: Microsoft VBScript runtime error '800a001c' Out of stack space: 'FixString'
Invalid Use Of 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 -------------------------------------------
Invalid Use Of Null: 'Replace'
I'm getting an "Invalid use of Null: 'Replace'" when rsDsp("comments") is NULL Code: Set rsDsp = DataConn.Execute("select * from comments2 where id = " & id & "") displayText = Replace(rsDsp("comments"), vbCrLf, "<BR>") Thought it would be easy enough to use an if statement, but I'm having no luck. Here's what I've butchered: Set rsDsp = DataConn.Execute("select * from comments2 where id = " & id & "") if IsNull(rsDsp("comments").value) then displayText = " " else displayText = Replace(rsDsp("comments"), vbCrLf, "<BR>") end if Could someone point me in the right direction?
Question -- Show If Not Null
I'm trying to create a conditional statement that will show the table row only if eventDate is NOT NULL. Here's what I thought should work: if (event.Fields.Item("eventDate").Value NOT NULL) I've also tried: if (event.Fields.Item("eventDate").Value != "") What am I missing?
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?
Posting ASP Null Character
i'm trying to post a section of XML code to an XMLSocket Server via ASP I can successfully connect to the server, but it won't disconnect because the string needs a null character inserted at the end in order for the socket server to terminate the connection. how would i do this? i've tried chr(32), chr(0). newdoc="<USER> +19024894124</USER><MESSAGE>test </MESSAGE><USERID>+19024894124 </USERID>"
Insert Value To Null Field
I have a field called w. The data type of the field is number. I use Access database. I cannot update a null value in the field. r3("w")="5" r3.update
Is Null Or Not An Object Error
I am working in html/asp within VisInterDev 6.0. Everything was working fine until I moved a text box from one page to another. I took it from within a form on one page to a form on another (and made the necessary changes in the two pages). Here is the code that is generating the error: <body onload="javascript:eventreg3.distance.focus();"> However I am using syntactically indentical code on other pages that work fine so I know the problem is not with that line. It appears that it is not able to find the "distance" text box, but I have been over and over the html and can't find an issue. If I take that line out (keeping the <body> of course) it doesn't generate an error but my submit button doesn't work.
Detect A Null Field
I have a 'brief' field (varchar, 2000 characters) that I sometimes want to leave Null. Getting SQL Server to leave a field Null is no problem, but getting ASP to differentiate a Null field from a populated one is proving a real headache!! How do you do this? I've tried: If Len(objRS("f_brief")) = 0 Then... etc. But it seems that Len(objRS("f_brief")) = 2 with a SQL Server database (though I've no idea why!!) Any ideas as to the best way to detect a genuinely Null (not just empty) field in a SQL Server database with ASP?
|