Sql Query Not Returning Correct Data

im trying to display a name from a table, by matching up where an assigned_to id = emp_id in another table. Code:

View Replies


ADVERTISEMENT

Returning Correct Data

I have a database which stores information,I have a page which has links to each of the rows in the database and to search by each row it has its own unique ID. The problem I am having is only one row keeps getting returned from the database.I have an access database and using ASP. I think the problem could be with the SQL statement.

SQL = "Select * FROM monitoring where monitoringID = & request('ID') &"

View Replies View Related

Delete Query Not Quite Correct

i need to delete some values which have dates that are less than today's from a table. The date is in another table so i joined the two tables together and gave a clause

I did this:Code:

DELETE *
FROM RMASerial, Sold
WHERE RMASerial.SoldID=Sold.SoldID
And Sold.Warranty_date<Date();

But that doesnt seem to be working.

View Replies View Related

SQL Query Not Returning Results In Access For Dates

I am trying to search through an access database for tickets createded with in a certin date. I am using the below code.

strdate = DateAdd("d", -2, Now())
sqlstr="SELECT * FROM Incidents WHERE TicketDate BETWEEN #"& Now() &"# AND #"& strdate &"# ;"

I verify the query with response.write and get the following.

SELECT * FROM Incidents WHERE TicketDate BETWEEN #15/07/04 19:19:32# AND #13/07/04 19:19:32# ;

I know there are 100% tickets within this date. Yet my query returns nuthing. Please help i've searched this forum for other peoples code looking for examples but end up with the same result.

View Replies View Related

Returning 0 Data

I have a table that has ticket number displays as a link.When I click on a ticket number it displays no data was return. (" it's not reading the ticket number I choose")Can someone look over my codes and tell me what should be doing! I am a the final part and I lost.

View Replies View Related

Returning SQL Data

I have written some ASP code that selects some records from a SQL database according to a criteria, if no information is found in the database then it sees there is an End Of File in the object record set and prints the line below:

<%if objRecordset.EOF then Response.Write("No information was found for the record you have entered") %>

My problem is that if no records are found it still tries to print the information that it is looking for and cannot find and thus throws an exception. The code for that is below:

<Table Border="1" BGCOLOR="white">

<% Response.Write "<TR><TD>The date for that record is " & objRecordset("DateTime") & "<br></TD></TR>" %>

View Replies View Related

@@Identity Not Returning Data??

I have some asp that should be inserting a shopper into my SQL Server DB. Code:

View Replies View Related

Returning Cache Data

I have an employee phone book application that is 5 years old. Written in asp with vb script calling sp's. when someone queries the all employee page they get all employees. When they then query employees by location it will again return the all employees data.

I changed the RS names in the all employee page in hopes that would fix it. I added the no cache code on all my pages and this hasn't helped. This app is 5 years old and hasn't changed at all but this just started happening within the past 6 months. When the user clears all cache and tries again it will work. How do I fix this?

View Replies View Related

Returning Values - Which Is Faster? ByRef Sub Or Value-returning Function

What is a faster/better coding practice?

Method 1:

Code:
Sub myFunction(byRef x)
x = x + 1 ' do something with x
End Sub

x = 7
myFunction(x)
response.write x ' shows 8
Method 2:

Code:
Function myFunction(x)
myFunction = x + 1 ' do something with x
End Function

x = 7
response.write myFunction(x) ' shows 8

Also discuss considerations when there are more than one variables that need to be changed.

View Replies View Related

SQL Query On Form Data

I need to select the data where the data ID is equal to the variable supplied in the submitted form. Below is the line of code I used for the radio select and the code to do the SQL search on it. I get the following error using this code:

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/MyWeb/CheckIn.asp, line 93

The items are listed by ID 1-X.

<input type=""radio"" name=""CheckIn"" value=x.value>Check In<br>

Dim junk
junk=request.form("CheckIn")
'If Session("UserType") = "User" Or Session("UserType") = "Admin" Then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db1.mdb")
Set rs=Server.CreateObject("ADODB.recordset")
'in below, WHERE id = Request.Form("CheckIn")
SQL = "SELECT * FROM CompsIn WHERE ID = junk"
rs.OPEN SQL, Conn, 3, 3

rs.OPEN SQL, Conn, 3, 3 = Line 93

View Replies View Related

ASP SQL Query Error With Data Types

I am trying to use a query to filter SQL Server 2000 records by a date
value.

Here is relevant columns in my database table (tblContent):

title [nvarchar]
starting [smalldatetime]

.... and here is my query:

Query = "SELECT title FROM tblContent WHERE starting = '" & date & "'"

I've done exactly this query on numberous occassions in the past with no
problems at all but this time I get the following error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data
type to smalldatetime data type resulted in an out-of-range smalldatetime
value.

What on earth is going on? I'm not using a char data type anywhere! I am
doing all the initial development locally and I have just installed XP
Service Pack 2. I realise it's unlikely, but that's the only thing I can
possibly attribute it to. Or am I just missing something obvious?

View Replies View Related

SELECT Data Form A Query

i try to get data form access with asp. The select contains 2 Subselects. If i set this SQl statement in Access it works. But if i set this in ASP it doesn't. Why??? There is no error. It's completly the same statement.

View Replies View Related

How To Retrieve The Data From Last Record Of The Query?

I have 2 tables Table_A and Table_B are linked together by TaID

Table_A
TaID - autonumber
Name
Address

Table_B
TbID - autonumber
TaID
Comments

here is my asp page
-------------------------
<%@ Language="VBScript" %>

<!-- #include file="connectionstring.asp" -->

<%
'declare variables
DIM ......

'Assign Variables
.......

Set Conn = Server.CreateObject("ADODB.Connection")

'database connection
Conn.provider = provider
Conn.ConnectionString = dbasepath
Conn.Open

'Sql statement to insert the data
sql = "insert into Table_A ( Name, Address) values (...*data from form*...)

' execute it
Conn.Execute(sql)

Response.Write "Data successfully inserted!"

Conn.Close

Set Conn = Nothing

--------------------------------------------

my question is I also need to insert the data to Table_B, but before that, I want to retrieve the Table_A.TaID first.

so if i do "select TaID from Table_A" and execute the sql how do I assign just the LAST record of TaID and assign to temp variable?

Do I allow to do that? if so, where should I put in the code above?

View Replies View Related

Retrieving Data From Database - Query String?

I have this page with photo thumbnails that are clickable. Each photo has corresponding info saved on a database. When the thumbnail is click, im trying to show the data in an asp page called info.asp.

sample:
Photo #1 when clicked goes to: info.asp?no=1
Photo #2 when clicked goes to: info.asp?no=2
so on so forth..

the database fields are:
no
picname
date
details

I only know how to display ALL info from a database.

But i cant figure out how to display SPECIFIC info triggered by a query string. Example. Photo #1 is clicked. I only want the data that corresponds to Photo 1 to be displayed. How can i do this?

View Replies View Related

Trying To Pass Form Data Gets Me: Syntax Error (missing Operator) In Query Expression

I'm trying to pass a piece of data i get from a query using a different form's passed values. This is how I get the data into the new form and how I try to pass it to the next asp page query.

<td valign=TOP width="168"><form action="HouseDetail.asp" method="post" name="MLS" id="MLS"><input name="MLS" type="hidden" value='<%=oRs("ML_Number")%>'><input name="Submit2" type="submit" value="Get Details"/></form></td>

The value='<%=oRS(ML_Number")%>' generates a real value like '2403943' - and the field I'm trying to use this value in the qry is expecting a number. But even passing the number without the single ' at both ends generates the same error message. Code:

View Replies View Related

Get Correct Percentage

I've always been looking for the best way to get an accurate percentage
statistics.

For example, in a election scenario:

Person A gets 33 votes
Person B gets 33 votes
Person C gets 34 votes
Person D gets 35 votes

Total votes = 33 + 33 + 34 + 35 = 135
Percent for A = 0.244.... = 0.24 = 24%
Percent for B = 0.244... = 0.24 = 24%
Percent for C = 0.251... = 0.25 = 25%
Percent for D = 0.259... = 0.26 = 26%

Then add up the percentage values: 24 + 24 + 25 + 26 = 99
(where it should be 100)

So, does anybody have a way to get around this problem? How should I
calculate the percentage for each person so that the percentage will add up
to 100 in the end?

View Replies View Related

Correct Formatting

I am trying to parse this response.write string but its coming up with a formatting error - can someone please tell me where I'm going wrong?Code:

Response.write ("<input name=""URL"" type=""text"" value=""http://www.evolvewebsitedesign.com/news-indiv.asp?news=" & rssite("News") & ""/>")

View Replies View Related

Correct Formatting

I am needing to response.write a variable within a snippet of Javascript.
My Javascript code that I need to response.write with the variable is below:-Code:

response.write ("imageArray[ImageNum++] = new imageItem(image_dir + ""variable here"");")

I can response.write the static Javascript string fine. The problem arises when I try and state a variable into where it says, 'variable here'
The variable I need to include is
Code:
rs.Fields("ImgURL")
Would someone please be able to show me the correct formatting for this Javascript string which includes the variable.

View Replies View Related

Correct Syntax

My asp syntax is very lacking, it seems the double quotes that have been
done by me are not what asp is looking for. Anyone that could correct my
faulty thinking would be thanked.

View Replies View Related

Correct Time

how to display correct time according to user timezone
i want to do an online meeting let say schedule meeting at 1:00pm server time, how do i display the correct time for users in their local time

View Replies View Related

Correct Syntax

I have a form where users can enter search criteria for various products.
now, if this form has 2 fields, colour and size (it wil have more but I'm
assuming the the principle for two fields will be the same for ten fields)
what would be the correct syntax for performing a query where the user
didn't enter a criteria for both fields?
the search string would be

strSQL = "SELECT * FROM products where colour = " & "'" &
request.form("searchstrcolour") & "'" & "AND size =" & "'"
request.form("searchstrsize") & "'" & " ORDER by price"

so if the user selects blue and large, thats fine
but what if the user only selected say blue and didn't bother with the size?
is there a wild card that I could use?

View Replies View Related

Correct Version

can someone explain to me the diffrence between the 2 below and why one works and the other one doesnt.could you also explain what each part of the correct version is doing because i dont really no.

INCORRECT

sql = "SELECT * FROM userlogon WHERE (username)=' "& (username) & "' AND (password)=' " & (password) & " ' "

CORRECT

sql = "SELECT * FROM [userlogon] WHERE [username]=' "& username & "' AND [password]=' " & password & " ' "

View Replies View Related

Correct Abbreviation Of ASP

is it active server pages or application service provider .which is correct

View Replies View Related

Update Correct

chk whether the code is correct? For the update date

SQL_query1 = "update Activity_Status set TotalTime = '" & Request.Form("time") & "', Score = '" & Request.Form("QuizScore") & "', Activity_Name = '" & Request.Form("QuizType") & "',ActivityDate = '" & "#" & Date() & "#" & "' where UserID ='" & Request.Form("username") & "' and Activity_Name='" & Request.Form("QuizType") & "'"

View Replies View Related

Redirect To Correct Page

I have a few pages that require login to access. Assuming a user clicks a
link containing a variable trying to access a password protected page. That
user is redirected to the login page. After login, he's brought to a "logged
in" page. How do I retain the original link he clicked and instead of
redirecting to a logged in page, he's redirected to the page he originally
requested?

View Replies View Related

Selecting Correct Details

Im trying to make a client area on my website and an not sure on how to go about editing clients details.When the client logs in they are brought to a menu where they can update there record. How can i get the appropriate record from the database so they can update there details?

View Replies View Related

UserName And Password Correct

On asp.net, How can we programmatically verify whether the UserName and Password is Correct? and when i close the application directly and open again, is still in lon in status.?

View Replies View Related

Function Not Returing Correct Value

i have this function in asp that should return false when a match is not found, but it keeps returning "exception occured". How do i go about getting this thing to work properly.Code:

public function isValidUserName(byVal user_name)
dim sqlComm

sqlComm = "SELECT USERNAME FROM S_USER WHERE USERNAME = '" & user_name & "'"

set oRs = oConn.Execute(sqlComm)

' if a match is found then return true
if oRs("username") = user_name then
isValidUserName = true
else
isValidUserName = false
end if

end function

View Replies View Related

Display Correct Time

how to display correct time according to user timezone. i want to do an online meeting
example: let say schedule meeting at 1:00pm server time, how do i display the correct time for users in their local time are there any tutorials to do this.

View Replies View Related

Set Correct Date Format

I have set with lcid value. but i am not able to overcome my nt server regional setting. Actually i want a date in mm/dd/yyyy. But i get date as mm/dd/yy. How to ensure that i shall always get correct format irrespective of os or regional setting.

View Replies View Related

The Correct Way To Close A Database Connection?

I'm looking at another developers code and I'm now confused about the correct way to close a database connection and destroy the object. I would normally do it this way: Code:

View Replies View Related

Passing Correct Value Types From ASP/VBScript To VB/DLL

I'm getting an error on my ASP page:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'StoreFileIntoField'

I assume - 99.5% - the error is generated because of worng value types,
I attemp to pass from my ASP/VBScript page to the VB/DLL function.

My relevant ASP/VBScript Code:

View Replies View Related

Passing Correct Value Types From ASP/VBScript To VB/DLL

I'm getting an error on my ASP page:

Microsoft VBScript runtime error '800a000d'
Type mismatch: 'StoreFileIntoField'

I assume - 99.5% - the error is generated because of worng value types,
I attemp to pass from my ASP/VBScript page to the VB/DLL function.

My relevant ASP/VBScript Code is:

View Replies View Related







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