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
SMS Coding Problem..Really need HELP
Old 07-14-2005, 01:04 AM SMS Coding Problem..Really need HELP
Novice Talker

Posts: 6
Trades: 0
Hello folks ,

i 'm facing a big trouble in sms coding.
1) I want to get the employee HP number.So, i have 2 tables which is Employees,Workorders.Then i run it , it only show "successfull" word only.WHY didn'y show out the HP number ???????????????Below is my code.

the second problem is i only can display some of the fields.Is it the length of the words or ...... EmployeeID2 no showing in the output...

EXP:

0000000001\nReserved\n11013140\n1\n\nSuccessful!
0000000002\nWITHDRAWAL\n11010234\n1\n\nSuccessful!
0000000003\nWITHDRAWAL\n11010236\n1\n\nSuccessful!
0000000004\nwithdrawal\n11230053\n3\n\nSuccessful!
0000000005\nREPLACE SLIDING GLASS\n11227046\n2\n\nSuccessful!
0000000006\n\n11205063\n2\n\nSuccessful!

<!-- #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



Response.Write (rs.Fields.Item("WorkorderNo")& "\n")
Response.Write (rs.Fields.Item("ProblemDescription")& "\n")
Response.Write (rs.Fields.Item("LocationNo")& "\n")
Response.Write (rs.Fields.Item("WorkStatus")& "\n")
Response.Write (rs.Fields.Item("EmployeeID2")& "\n" )

'Response.Write ("ESI:" & rs.Fields.Item("EstDateStart"))
'Response.Write ("ESO:" & rs.Fields.Item("EstDateEnd"))


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



sql2 = "SELECT * FROM Employees WHERE EmployeeNO = '" & rs.Fields.Item("EmployeeID2") & "' "
rs2.Open sql2, oConn
'Response.Write (rs2.Fields.Item("EmployeeNO"))
if not rs2.eof then
Sender = rs2.Fields("HandPhone")
Response.Write ("Send SMS:" & rs2.Fields("HandPhone")& " ")
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:45 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
1/ In VbScript a new line is vbCrLf not \n

2/ you seem to have set a meta refresh on a page with executable code this can cause problems with server resources as it could end up leaving the DB objects open.

3/ if the "HandPhone" field is is the problem one, I would expect it to be a text field (memo if you are using access). There is a well known issue with this type of field in ADO where if you reference it twice, the value is empty for the second time. The solution is to transfer the value to a variable then reference that.
__________________
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 online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-14-2005, 10:03 PM
Novice Talker

Posts: 6
Trades: 0
i had solved the problem based on your guide.

thanks you guy...
williamLOR is offline
Reply With Quote
View Public Profile
 
Old 07-14-2005, 10:22 PM
Novice Talker

Posts: 6
Trades: 0
Quote:
Originally Posted by williamLOR
Hello folks ,

i 'm facing a big trouble in sms coding.
1) I want to get the employee HP number.So, i have 2 tables which is Employees,Workorders.Then i run it , it only show "successfull" word only.WHY didn'y show out the HP number ???????????????Below is my code.

the second problem is i only can display some of the fields.Is it the length of the words or ...... EmployeeID2 no showing in the output...

EXP:

0000000001\nReserved\n11013140\n1\n\nSuccessful!
0000000002\nWITHDRAWAL\n11010234\n1\n\nSuccessful!
0000000003\nWITHDRAWAL\n11010236\n1\n\nSuccessful!
0000000004\nwithdrawal\n11230053\n3\n\nSuccessful!
0000000005\nREPLACE SLIDING GLASS\n11227046\n2\n\nSuccessful!
0000000006\n\n11205063\n2\n\nSuccessful!

<!-- #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



Response.Write (rs.Fields.Item("WorkorderNo")& "\n")
Response.Write (rs.Fields.Item("ProblemDescription")& "\n")
Response.Write (rs.Fields.Item("LocationNo")& "\n")
Response.Write (rs.Fields.Item("WorkStatus")& "\n")Response.Write (rs.Fields.Item("EmployeeID2")& "\n" )

'Response.Write ("ESI:" & rs.Fields.Item("EstDateStart"))
'Response.Write ("ESO:" & rs.Fields.Item("EstDateEnd"))


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



sql2 = "SELECT * FROM Employees WHERE EmployeeNO = '" & rs.Fields.Item("EmployeeID2") & "' "
rs2.Open sql2, oConn
'Response.Write (rs2.Fields.Item("EmployeeNO"))
if not rs2.eof then
Sender = rs2.Fields("HandPhone")
Response.Write ("Send SMS:" & rs2.Fields("HandPhone")& " ")
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
%>
hello expert,

i found the other problem.When i run my script.It was pop out this error.
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
williamLOR is offline
Reply With Quote
View Public Profile
 
Old 07-14-2005, 10:25 PM
Novice Talker

Posts: 6
Trades: 0
Quote:
Originally Posted by williamLOR
Hello folks ,

i 'm facing a big trouble in sms coding.
1) I want to get the employee HP number.So, i have 2 tables which is Employees,Workorders.Then i run it , it only show "successfull" word only.WHY didn'y show out the HP number ???????????????Below is my code.

the second problem is i only can display some of the fields.Is it the length of the words or ...... EmployeeID2 no showing in the output...

EXP:

0000000001\nReserved\n11013140\n1\n\nSuccessful!
0000000002\nWITHDRAWAL\n11010234\n1\n\nSuccessful!
0000000003\nWITHDRAWAL\n11010236\n1\n\nSuccessful!
0000000004\nwithdrawal\n11230053\n3\n\nSuccessful!
0000000005\nREPLACE SLIDING GLASS\n11227046\n2\n\nSuccessful!
0000000006\n\n11205063\n2\n\nSuccessful!

<!-- #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



Response.Write (rs.Fields.Item("WorkorderNo")& "\n")
Response.Write (rs.Fields.Item("ProblemDescription")& "\n")
Response.Write (rs.Fields.Item("LocationNo")& "\n")
Response.Write (rs.Fields.Item("WorkStatus")& "\n")

Response.Write (rs.Fields.Item("EmployeeID2")& "\n" )
'Response.Write ("ESI:" & rs.Fields.Item("EstDateStart"))
'Response.Write ("ESO:" & rs.Fields.Item("EstDateEnd"))


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



sql2 = "SELECT * FROM Employees WHERE EmployeeNO = '" & rs.Fields.Item("EmployeeID2") & "' "
rs2.Open sql2, oConn
'Response.Write (rs2.Fields.Item("EmployeeNO"))
if not rs2.eof then
Sender = rs2.Fields("HandPhone")
Response.Write ("Send SMS:" & rs2.Fields("HandPhone")& " ")
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
%>
hello expert,

i found the other problem.When i run my script.It was pop out this error.
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
williamLOR is offline
Reply With Quote
View Public Profile
 
Old 07-15-2005, 03:35 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Which line errors out and does it error out the first time it runs ?
__________________
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 online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-16-2005, 12:10 AM
Novice Talker

Posts: 6
Trades: 0
Quote:
Originally Posted by chrishirst
Which line errors out and does it error out the first time it runs ?

Thanks for your concern chrishirst. :

Problem had solved and my program free of error.
williamLOR is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to SMS Coding Problem..Really need HELP
 

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.37153 seconds with 12 queries