Error in code.. | Bytes (2024)

Home Posts Topics Members FAQ

haridhasekar

Error in code.. | Bytes (2) 8 New Member

hi ...
i wanna store in the backend sql server 2000, while validation its not at all stored... i have attached the codings ... pls check....

Expand|Select|Wrap|Line Numbers

  1. trial.asp
  2. <%@Language=VBScript%>
  3. <%
  4. dimrs
  5. SetCon=Server.CreateObject("ADODB.connection")
  6. con.CursorLocation=3
  7. con.ConnectionString="driver={sqlserver};server=yummy;uid=gal;pwd=gal;database=pubs"
  8. con.Open
  9. Setrs=Server.CreateObject("ADODB.Recordset")
  10. session("emp_no")=Request.Form("emp_no")
  11. session("emp_name")=Request.Form("emp_name")
  12. session("sal")=Request.Form("sal")
  13. subinsert()
  14. rs.Fields("empno")=session("emp_no")
  15. rs.Fields("empname")=session("emp_name")
  16. rs.Fields("sal")=session("sal")
  17. endsub
  18. flag=Request.QueryString("flag")
  19. ifflag="insert"then
  20. rs.Open"SELECT*FROMempdtl",con,2,3
  21. rs.AddNew
  22. insert()
  23. rs.Update
  24. endif
  25. session("msg")="Recordsupdatedsuccessfully."
  26. Response.Redirect"trialmain.asp"
  27. %>

and another asp file as:

Expand|Select|Wrap|Line Numbers

  1. trialmain.asp
  2. <%@Language=VBScript%>
  3. <scriptlanguage="javascript">
  4. functionformvalidation()
  5. {
  6. varempno=document.getElementById('emp_no');
  7. varempname=document.getElementById('emp_name');
  8. varsal=document.getElementById('sal');
  9. if(isNumeric(empno,"Pleaseenterthenumber")
  10. {
  11. if(isAlphabet(empname,"Pleaseenterthename")
  12. {
  13. isNumeric(sal,"Pleaseenterthesalary")
  14. {
  15. document.f1.action="trial.asp?flag=insert"
  16. document.f1.submit();
  17. returntrue;
  18. }
  19. }
  20. }
  21. returnfalse;
  22. }
  23. functionisNumeric(elem,helperMsg){
  24. varnumericExpression=/^[0-9]+$/;
  25. if(elem.value.match(numericExpression)){
  26. returntrue;
  27. }else{
  28. alert(helperMsg);
  29. elem.focus();
  30. returnfalse;
  31. }
  32. }
  33. functionisAlphabet(elem,helperMsg){
  34. varalphaExp=/^[a-zA-Z]+$/;
  35. if(elem.value.match(alphaExp)){
  36. returntrue;
  37. }else{
  38. alert(helperMsg);
  39. elem.focus();
  40. returnfalse;
  41. }
  42. }
  43. </script>
  44. <HTML>
  45. <HEAD>
  46. <METANAME="GENERATOR"Content="MicrosoftVisualStudio6.0">
  47. </HEAD>
  48. <BODY>
  49. <FORMmethod=postid=f1name=f1>
  50. <%
  51. SetCon=Server.CreateObject("ADODB.connection")
  52. con.CursorLocation=3
  53. con.ConnectionString="driver={sqlserver};server=yummy;uid=gal;pwd=gal;database=pubs"
  54. con.Open
  55. msg=session("msg")
  56. session("msg")=""
  57. emp_no=session("emp_no")
  58. emp_name=session("emp_name")
  59. sal=session("sal")
  60. %>
  61. <FORMmethod=postname=fo1id=fo1>
  62. <TABLEstyle="WIDTH:334px;HEIGHT:90px"cellSpacing=1cellPadding=1width=334
  63. border=0>
  64. <TR>
  65. <TD>EmployeeNo</TD>
  66. <TD><INPUTtype="text"id="emp_no"value=<%=emp_no%>></TD></TR>
  67. <TR>
  68. <TD>EmployeeName</TD>
  69. <TD><INPUTtype="text"id="emp_name"value=<%=emp_name%>></TD></TR>
  70. <TR>
  71. <TD>Salary</TD>
  72. <TD><INPUTtype="text"id="sal"value=<%=sal%>></TD></TR></TABLE>
  73. <P><inputname="Submit1"type="submit"value="submit"onclick="javascript:formvalidation()"></P></FORM>
  74. </form>
  75. </BODY>
  76. <%
  77. iflen(msg&"")>0then
  78. Response.Write"<scriptlanguage=javascript>"
  79. Response.Write"{alert('"&msg&"');}</script>"
  80. msg=""
  81. endif
  82. %>
  83. </HTML>

Mar 10 '10 #1

Subscribe Reply

jhardman

3,406 Error in code.. | Bytes (6) Recognized Expert Specialist

so what problem are you having?

Jared

Mar 11 '10 #2

reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 16233

Error during deployment

by: Tony Wright |last post by:

Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information Server might not be running or the path exists and is redirected to another machine. Please check the status of this virtual directory in the Internet...

.NET Framework

6 4727

Error Trapping In Access 2000

by: Peter Frost |last post by:

Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance

Microsoft Access / VBA

7 4992

Error crystal websetup 9 install

by: p |last post by:

WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version,...

ASP.NET

2 19436

Custom Error Messages in Access

by: hyperpau |last post by:

Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's...

Visual Basic 4 / 5 / 6

2897

Custom Error Messages

by: hyperpau |last post by:

Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's...

Microsoft Access / VBA

7778

What is ONU?

by: marktang |last post by:

ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...

General

7687

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...

Windows Server

1 7777

The easy way to turn off automatic updates for Windows 10/11

by: Hystou |last post by:

Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...

Windows Server

6413

AI Job Threat for Devs

by: agi2029 |last post by:

Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...

Career Advice

5290

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...

C# / C Sharp

3731

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

Networking - Hardware / Configuration

1 2203

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

1 1300

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

1039

Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy

by: bsmnconsultancy |last post by:

In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

General

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisem*nts and analytics tracking please visit the page.

Error in code.. | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6380

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.