Register Blogs FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "Lock page/recordset?" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). Visit the ASP Development forum for help with ASP/VBScript and ASP/JScript applications.


Closed Thread
 
LinkBack Thread Tools Display Modes
  #11  
Old October 16th, 2008, 02:41 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 295
Thanks: 54
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Hi Wolffy,

Can you see what I'm doing wrong here?

Record Results screen, to:
Code:
<TD><a href="edit.asp?MyID=<%=rs("MyID")%>&RecDate=<%=rs("RecordDt")%>">edit</a></TD>
now on the Edit screen, I don't get any records with:
Code:
Dim sMyID,sRecDate
sMyID = Request("MyID")
sRecDate = Request("RecordDt")

Set rs = Server.CreateObject ("ADODB.Recordset")
 
'build SQL
sSql = "SELECT * FROM dbo.tblTEST"
sSql = sSql & " WHERE MyID='" & sMyID & "' and RecDate='" & sRecDate & "'"
Sponsored Links
  #12  
Old October 16th, 2008, 03:02 PM
Wolffy's Avatar
Slaprentice of Wolves
 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 176
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default

OK, see what you are trying here. When you get to the Edit screen, you want to make sure that the record you pull up hasn't changed since being displayed on the results screen, right? Sound good to me.

Looks like you're pulling "RecordDt" and then comparing to "RecDate" tho. Are this both fields in your table?
__________________
Wolffy
------------------------
Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary.
  #13  
Old October 16th, 2008, 03:10 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 295
Thanks: 54
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

um...nope, ony RecordDt...is that the problem?
  #14  
Old October 16th, 2008, 03:12 PM
Wolffy's Avatar
Slaprentice of Wolves
 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 176
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default

Then I think the WHERE clause should be and RecordDt = '" & sRecDate & "'" unless I'm missing sumpin'
  #15  
Old October 16th, 2008, 03:22 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 295
Thanks: 54
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

if i take off the AND and RecordDt = '" & sRecDate & "' ...i get the record...
I have to have that correct? so when I do the update part you suggested...
  #16  
Old October 16th, 2008, 03:33 PM
Wolffy's Avatar
Slaprentice of Wolves
 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 176
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default

Sorry..what I'm getting at is the field called RecDate or RecordDt? Assuming the field name is correct, I'd then Response.Write the value of sRecDate to ensure it's what you think it is (i.e. not blank, has full date/time not just time, etc).
  #17  
Old October 16th, 2008, 03:53 PM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 295
Thanks: 54
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

seems to be good Wolffy....

it returned:
Code:
SELECT * FROM dbo.tblTEST WHERE MyID='249' and RecordDt='10/16/2008 1:29:38 PM'
  #18  
Old October 16th, 2008, 04:47 PM
Wolffy's Avatar
Slaprentice of Wolves
 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 176
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default

Hmmm...OK, then go and pull up record 249 and see what's there. I suspect that you are truncating the milliseconds from the datetime value as stored in the record and thus not getting a match.

Working with datetime values can ugly -- however it's interesting to note that a datetime is stored as a numeric and can be converted to a float. Sometime they can be easier to work with as a numeric value.
  #19  
Old October 17th, 2008, 08:45 AM
Rebelle's Avatar
Barn Enthusiast
 
Join Date: Mar 2008
Posts: 295
Thanks: 54
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

ok...i checked and this is what it had in it

10/16/2008 1:29:38 PM

datetime(8)
  #20  
Old October 17th, 2008, 09:30 AM
Wolffy's Avatar
Slaprentice of Wolves
 
Join Date: Mar 2008
Location: Peoria, IL
Posts: 176
Thanks: 3
Thanked 24 Times in 21 Posts
Rep Power: 1
Wolffy is on a distinguished road

Awards Showcase
Microsoft .Net 
Total Awards: 1

Default

I'm still leaning toward truncation of milliseconds here. Run the following query and see what you get:
Select cast(RecordDT as float), cast(cast('10/16/2008 1:29:38 PM' as datetime) as float) from dbo.tblTEST WHERE MyID='249'
Closed Thread

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve unknown recordset field names in table? BLaaaaaaaaaarche ASP Development 2 August 10th, 2008 08:33 AM
Help with asp display / recordset (troubleshoot) Rebelle ASP Development 27 June 30th, 2008 11:19 AM
go page to page questionaire app peebman2000 .Net Development 3 April 26th, 2008 04:42 PM


All times are GMT -4. The time now is 09:13 AM.



Content Relevant URLs by vBSEO 3.2.0