Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Fail to retrieve a data field after connect to the ODBC data source!
Old 07-13-2005, 06:03 AM Fail to retrieve a data field after connect to the ODBC data source!
Novice Talker

Posts: 6
Trades: 0
Dear experts,
i have 2 table in my database which are "Workorder" & "Employees"."Workorder" contain a field call SMSStatus & EmployeeID2 where my "Employees" table contain a field call EmployeeNO. EmployeeNO and EmployeeID2 is exactly the same datatype and value. Below script will first look in "Workorder" table and search for SMSStatus=0 and retrieve the data that i want and send the sms out to the technician(technician phone number is from Employees table). After the sms has been send out, the SMSstatus will update to 1. Whole script work fine but there are some bugs in btw the code. i cant retrieve rs.field.item("EmployeeID2") data out from the recordset and therefore i cant get the technician handphone! Question is why i cant retrieve the rs.field.item("EmployeeID2")? Even though I have double check the field and make sure the field is exist in the database , but stil fail to retireve that field. I also tried to output the field onto the screen b4 the rs.eof execute but stil fail to do it. Help ! WHY?

<!-- #include file="config.asp" -->
<META HTTP-EQUIV="refresh" CONTENT="<%Response.Write(Rate)%>">
<%
dim Time1, Time2
Dim JID, SN, Req, Code, Logtime, ESI, ESO

set oConn=Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
connectionStr = "DSN="& SMSDSN &"; UID="& UserID &";PWD="& Password&";"
oConn.Open connectionStr

sql = "SELECT * FROM " & SMSWorkorder & " WHERE SMSStatus = '0'"
rs.Open sql, oConn

do until rs.EOF


Time1 = Second(Time)
Time2 = Second(Time)

Result1 = "SMS == JID: " & rs.Fields.Item("WorkorderNo") & "\n" & "SN: " & rs.Fields.Item("LocationNo") & "\n" & "Req: " & rs.Fields.Item("ProblemDescription") & "\n" & "Code: " & rs.Fields.Item("WorkStatus") & "\n" & "Lt: " & rs.Fields.Item("DateReceived") & "\n" & "ESI: " & rs.Fields.Item("EstDateStart") & "\n" & "ESO: " & rs.Fields.Item("EstDateEnd") & "<br>"
Response.Write (Result1)

'add checking

if not rs.eof then
JID = rs.Fields.Item("WorkorderNo")
SN = rs.Fields.Item("LocationNo")
Req = rs.Fields.Item("ProblemDescription")
Code = rs.Fields.Item("WorkStatus")
Logtime = rs.Fields.Item("DateReceived")
ESI = rs.Fields.Item("EstDateStart")
ESO = rs.Fields.Item("EstDateEnd")
else
Response.Write ("Event table database empty for <br>" & rs.Fields.Item("WorkorderNo") )
end if

sql2 = "SELECT * FROM " & SMSTechnician & " WHERE EmployeeNo = '" & rs.Fields.Item("EmployeeID2") & "'"

rs2.Open sql2, oConn
if not rs2.eof then
Sender = rs2.Fields(9)
Response.Write ("Send SMS:" & rs2.Fields(9)& " ")
end if
rs2.close
k = 0
while k = 0
Time2 = Second(Time)
if Time2 - Time1 = 1 then
Response.Write ("Successful!<br>")
%>
<!-- #include file="loopsms.asp" -->
<%
sql3 = "UPDATE " & SMSWorkorder & " SET SMSStatus = '1' WHERE WorkorderNo = '" & rs.Fields.Item("WorkorderNo") & "'"
oConn.Execute sql3
k = 1
end if
wend

rs.MoveNext


loop

rs.close
oConn.close
%>
williamLOR is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-14-2005, 02:47 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I guess this is an earlier question identical to the one I've just answered.

Please do not start multiple threads for the same question.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Fail to retrieve a data field after connect to the ODBC data source!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10638 seconds with 12 queries