please read this code Code: <%@ language="javascript"%> <html> <head> <script language="javascript"> <!-- function validate(noofticks,avail) { alert("Inside validate"); } --> </script> </head> <body> <% Set MyConn = Server.CreateObject("ADODB.Connection") MyConn.Open <<hidden for security>> var rc,dt,mt,avail rc=Request.Form("rcode") dt=Request.Form("da") mt=Request.Form("mo") SQL_query="select * from route_booking_details" Set RS=MyConn.Execute(SQL_query) while(RS.EOF != 0) { if(rc == RS("Rcode") && dt == RS("Date") && mt == RS("Month")) { if(RS("Count") < 40) { Response.write("No. of tickets available = " & (40-RS("Count"))) avail = 40 - RS("Count") Response.write("<form name='noofticks' onSubmit='return validate(this,avail)' action='http://localhost/Project/confirm.asp' method='post'>") Response.write("Enter no. of tickets to book : ") Response.write("<input type='text' name='num'>") Response.write("<br>") Response.write("<input type='submit' value='Book Tickets'>") } else { Response.write("Sorry...the bus is full. No tickets available") } RS.Close MyConn.Close Response.End } RS.MoveNext } Response.write("No. of tickets available = 40") RS.Close MyConn.Close %> </body> </html> this is the code. this is a .asp file in an iis server. now i am getting the following error in the browser.... Error Type: Microsoft JScript compilation (0x800A03EC) Expected ';' /Project/ch_avail.asp, line 15, column 4 Set MyConn = Server.CreateObject("ADODB.Connection") ---^ what is the error !!! i put the semi colon at the end of the stmt just to check...still the same error. plz debug for me.
There is no such keyword as Set in JavaScript, its used in VBScript. Code: /* not like this */ Set MyConn = Server.CreateObject("ADODB.Connection") /* like this */ var myConn; MyConn = Server.CreateObject("ADODB.Connection"); Moreover, you did not use the line delimiter.