freelanceprogrammers.org Forum Index » ASP

ASP Problem


View user's profile Post To page top
klrclark Posted: Tue Jan 11, 2005 1:31 am


Joined: 11 Jan 2005

Posts: 7
ASP Problem
I have a drop down list that is populated by fields from a table
called PayGradeSteps.

Here is the code
Do Until RSPayGradeSteps.EOF
%><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
("PaySalary") %> <option Value="<% response.write Pay %>"><%
response.write Pay %></option>
<% RSPayGradeSteps.MoveNext
Loop


the drop down list is populated but when I take the values the user
selected and insert them my employee table my salary is being cut
off. Here is the code for the insert:
if not isempty(Request.Form("OK")) then
SField = Request.Form("PaySalary")
Salary = mid(SField, 6, 4)
PayStep = mid(SField, 1, 2)
conn.execute "update tblemployee set " _
& "Salary = `" & Salary & "`, " _
& "PayStep = `" & Paystep & "`, " _
& "Paygrade = `" & Request.Form("Paysave") & "` " _
& "where SSN = `" & Request.Form("EmpId") & "` "
Response.Redirect "./Previous_Addh1.asp?LoginSSN=" & Request.Form
("Save1")
end if
set RSEmp = conn.execute("select * from TBLemployee where EmpId = `"
& EmpId & "` ")

Can you tell me how I can fix this and also how can you validate
that a value is being inserted into the field in the employee table.
I have some records where no value was inserted (I cannot duplicate
this in my testing though).

Any help is greatly appreciated.

Karen
Reply with quote
Send private message
View user's profile Post To page top
charlesmarkc... Posted: Tue Jan 11, 2005 1:39 am


Joined: 07 Jan 2006

Posts: 63
ASP Problem
http://www.learnasp.com/learn/debug2.asp
gives good model for seeing if a SQL statement generates an error.

If it does generate an error emailing onself the SQL statement will
allow you to diagnose why it errored and fix the data later since you
will then have a record of what they tried to insert.


On Mon, 10 Jan 2005 19:31:50 -0000, klrclark <klrclark@...> wrote:
>
> I have a drop down list that is populated by fields from a table
> called PayGradeSteps.
>
> Here is the code
> Do Until RSPayGradeSteps.EOF
> %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> response.write Pay %></option>
> <% RSPayGradeSteps.MoveNext
> Loop
>
>
> the drop down list is populated but when I take the values the user
> selected and insert them my employee table my salary is being cut
> off. Here is the code for the insert:
> if not isempty(Request.Form("OK")) then
> SField = Request.Form("PaySalary")
> Salary = mid(SField, 6, 4)
> PayStep = mid(SField, 1, 2)
> conn.execute "update tblemployee set " _
> & "Salary = `" & Salary & "`, " _
> & "PayStep = `" & Paystep & "`, " _
> & "Paygrade = `" & Request.Form("Paysave") & "` " _
> & "where SSN = `" & Request.Form("EmpId") & "` "
> Response.Redirect "./Previous_Addh1.asp?LoginSSN=" & Request.Form
> ("Save1")
> end if
> set RSEmp = conn.execute("select * from TBLemployee where EmpId = `"
> & EmpId & "` ")
>
> Can you tell me how I can fix this and also how can you validate
> that a value is being inserted into the field in the employee table.
> I have some records where no value was inserted (I cannot duplicate
> this in my testing though).
>
> Any help is greatly appreciated.
>
> Karen
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
>
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> To unsubscribe from this group, send an email to:
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Reply with quote
Send private message
View user's profile Post To page top
charlesmarkc... Posted: Tue Jan 11, 2005 1:41 am


Joined: 07 Jan 2006

Posts: 63
ASP Problem
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk
is better place for this question.

All the Classic ASP experts live there. Many of them are not on this list.


On Mon, 10 Jan 2005 19:31:50 -0000, klrclark <klrclark@...> wrote:
>
> I have a drop down list that is populated by fields from a table
> called PayGradeSteps.
>
> Here is the code
> Do Until RSPayGradeSteps.EOF
> %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> response.write Pay %></option>
> <% RSPayGradeSteps.MoveNext
> Loop
>
>
> the drop down list is populated but when I take the values the user
> selected and insert them my employee table my salary is being cut
> off. Here is the code for the insert:
> if not isempty(Request.Form("OK")) then
> SField = Request.Form("PaySalary")
> Salary = mid(SField, 6, 4)
> PayStep = mid(SField, 1, 2)
> conn.execute "update tblemployee set " _
> & "Salary = `" & Salary & "`, " _
> & "PayStep = `" & Paystep & "`, " _
> & "Paygrade = `" & Request.Form("Paysave") & "` " _
> & "where SSN = `" & Request.Form("EmpId") & "` "
> Response.Redirect "./Previous_Addh1.asp?LoginSSN=" & Request.Form
> ("Save1")
> end if
> set RSEmp = conn.execute("select * from TBLemployee where EmpId = `"
> & EmpId & "` ")
>
> Can you tell me how I can fix this and also how can you validate
> that a value is being inserted into the field in the employee table.
> I have some records where no value was inserted (I cannot duplicate
> this in my testing though).
>
> Any help is greatly appreciated.
>
> Karen
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
>
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> To unsubscribe from this group, send an email to:
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Reply with quote
Send private message
View user's profile Post To page top
dexilalolai Posted: Tue Jan 11, 2005 1:42 am


Joined: 11 Jan 2005

Posts: 1
ASP Problem
Convoluted Context Switching, Batman!
>
> Here is the code
> Do Until RSPayGradeSteps.EOF
> %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> response.write Pay %></option>
> <% RSPayGradeSteps.MoveNext
> Loop

This is an aside to your issue, but to ease readibility and the
webserver`s heart rate, you might reconsider how the above code is
structured. Each pair of <% %> toggles the webserver in and out of
`ASP code reading` mode, which is a performance hit.

>
> SField = Request.Form("PaySalary")
> Salary = mid(SField, 6, 4)
> PayStep = mid(SField, 1, 2)

So you have one form field that is responsible for two data elements?
Eek. I think your trouble might lay in the mid(SField, 6, 4) call
above. Is it possible to redo the form itself and make it two
separate form fields?


> Can you tell me how I can fix this and also how can you validate
> that a value is being inserted into the field in the employee
> table.
> I have some records where no value was inserted (I cannot duplicate

You can compare against the empty string (""). If it`s empty, don`t
insert it. Have you tried that?


Good luck, hope this helps--
Scott
Reply with quote
Send private message
View user's profile Post To page top
klrclark Posted: Tue Jan 11, 2005 1:44 am


Joined: 11 Jan 2005

Posts: 7
ASP Problem
Should I post my question there? I have inherited this system and
do not know a lot about ASP . There is no error. I just need to
know how do I keep the salary from being cut off

Here is a snippet of the data they see in the drop down list

<option Value="22 $ 10.20">22 $ 10.20</option>
<option Value="23 $ 10.25">23 $ 10.25</option>
<option Value="24 $ 10.30">24 $ 10.30</option>
<option Value="25 $ 10.35">25 $ 10.35</option>
<option Value="26 $ 5.50">26 $ 5.50</option>
<option Value="1 $ 9.05">1 $ 9.05</option>
<option Value="2 $ 9.10">2 $ 9.10</option>
<option Value="3 $ 9.15">3 $ 9.15</option>

When the value = 1 through 9 the first number is the salary is
deleted when the record is written to the employee table.

thanks.

--- In AspNetAnyQuestionIsOk@yahoogroups.com, Charles Carroll
<911@l...> wrote:
> http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk
> is better place for this question.
>
> All the Classic ASP experts live there. Many of them are not on
this list.
>
>
> On Mon, 10 Jan 2005 19:31:50 -0000, klrclark <klrclark@y...> wrote:
> >
> > I have a drop down list that is populated by fields from a
table
> > called PayGradeSteps.
> >
> > Here is the code
> > Do Until RSPayGradeSteps.EOF
> > %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> > ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> > response.write Pay %></option>
> > <% RSPayGradeSteps.MoveNext
> > Loop
> >
> >
> > the drop down list is populated but when I take the values the
user
> > selected and insert them my employee table my salary is being
cut
> > off. Here is the code for the insert:
> > if not isempty(Request.Form("OK")) then
> > SField = Request.Form("PaySalary")
> > Salary = mid(SField, 6, 4)
> > PayStep = mid(SField, 1, 2)
> > conn.execute "update tblemployee set " _
> > & "Salary = `" & Salary & "`, " _
> > & "PayStep = `" & Paystep & "`, " _
> > & "Paygrade = `" & Request.Form("Paysave") & "` " _
> > & "where SSN = `" & Request.Form("EmpId") & "` "
> > Response.Redirect "./Previous_Addh1.asp?LoginSSN=" &
Request.Form
> > ("Save1")
> > end if
> > set RSEmp = conn.execute("select * from TBLemployee where EmpId
= `"
> > & EmpId & "` ")
> >
> > Can you tell me how I can fix this and also how can you
validate
> > that a value is being inserted into the field in the employee
table.
> > I have some records where no value was inserted (I cannot
duplicate
> > this in my testing though).
> >
> > Any help is greatly appreciated.
> >
> > Karen
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Sponsor
> >
> > ADVERTISEMENT
> >
> >
> > ________________________________
> > Yahoo! Groups Links
> >
> > To visit your group on the web, go to:
> > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> >
> > To unsubscribe from this group, send an email to:
> > AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
> >
> > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
Reply with quote
Send private message
View user's profile Post To page top
klrclark Posted: Tue Jan 11, 2005 1:46 am


Joined: 11 Jan 2005

Posts: 7
ASP Problem
No I have not tried to compare against an empty string.

I inherited this system. so I have what I have. I appreciate you
help.


--- In AspNetAnyQuestionIsOk@yahoogroups.com, Scott Dexter
<dexilalolai@y...> wrote:
> Convoluted Context Switching, Batman!
> >
> > Here is the code
> > Do Until RSPayGradeSteps.EOF
> > %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> > ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> > response.write Pay %></option>
> > <% RSPayGradeSteps.MoveNext
> > Loop
>
> This is an aside to your issue, but to ease readibility and the
> webserver`s heart rate, you might reconsider how the above code is
> structured. Each pair of <% %> toggles the webserver in and out of
> `ASP code reading` mode, which is a performance hit.
>
> >
> > SField = Request.Form("PaySalary")
> > Salary = mid(SField, 6, 4)
> > PayStep = mid(SField, 1, 2)
>
> So you have one form field that is responsible for two data
elements?
> Eek. I think your trouble might lay in the mid(SField, 6, 4) call
> above. Is it possible to redo the form itself and make it two
> separate form fields?
>
>
> > Can you tell me how I can fix this and also how can you validate
> > that a value is being inserted into the field in the employee
> > table.
> > I have some records where no value was inserted (I cannot
duplicate
>
> You can compare against the empty string (""). If it`s empty, don`t
> insert it. Have you tried that?
>
>
> Good luck, hope this helps--
> Scott
Reply with quote
Send private message
View user's profile Post To page top
charlesmarkc... Posted: Tue Jan 11, 2005 1:53 am


Joined: 07 Jan 2006

Posts: 63
ASP Problem
On Mon, 10 Jan 2005 11:42:18 -0800 (PST), Scott Dexter
<dexilalolai@...> wrote:
> Convoluted Context Switching, Batman!
> >
> > Here is the code
> > Do Until RSPayGradeSteps.EOF
> > %><% Pay = RSPayGradeSteps("PayStep") & " $ " & RSPayGradeSteps
> > ("PaySalary") %> <option Value="<% response.write Pay %>"><%
> > response.write Pay %></option>
> > <% RSPayGradeSteps.MoveNext
> > Loop
>
> This is an aside to your issue, but to ease readibility and the
> webserver`s heart rate, you might reconsider how the above code is
> structured. Each pair of <% %> toggles the webserver in and out of
> `ASP code reading` mode, which is a performance hit.
Actually that is based on OLD info. It is an urban myth these days
like alligators in the NY sewers.

the context switches don`t happen. A page gets converted ONCE to many
response.writes the first time IIS sees the page. But older
IIS/ASP.DLLs had teh flaw you are talking about. Trust me hundreds of
hours of research on that one.

If he wants to make code faster he should use GETSTRING ala
http://www.learnasp.com/advice/whygetrows.asp
and if he wants to make it more reusable with methods similar to:
http://www.learnasp.com/learn/subdblist.asp


http://www.learnasp.com/learn/rsfast.asp
actually kills 2 birds with one stone
specifically http://www.learnasp.com/learn/rsfast-lists.asp
Reply with quote
Send private message
View user's profile Post To page top
charlesmarkc... Posted: Tue Jan 11, 2005 2:43 am


Joined: 07 Jan 2006

Posts: 63
ASP Problem
On Mon, 10 Jan 2005 19:44:44 -0000, klrclark <klrclark@...> wrote:
>
> Should I post my question there? I have inherited this system and
> do not know a lot about ASP .

A lot of us have forgotten Classic ASP too much ASP.net time spent.

The people at
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk
know ASP like the back of their hand and will knwo the salary cutoff
and other answers quick.
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help