This is a discussion on "Help on ASP procedure with VBScript" within the Classic ASP section. This forum, and the thread "Help on ASP procedure with VBScript are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Help on ASP procedure with VBScript
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Help on ASP procedure with VBScript
I am new to ASP and been bugged down with this problem.
<font color="red">Below is a portion of my code and it runs perfectly: Now when I change the value of formCategory it will call the function CheckRequiredText() and that is where I encounter problem</font id="red"> <% varStaffName=Request.Cookies("varStaffName") varDescription=Request.Cookies("varModuleDescripti on") formDateFrom=Request.Cookies("varFormDatefrom") formDateTo=Request.Cookies("varFormDateTo") strSQL= " SELECT ModuleCode, ProgressComponentCode, ProgressComponentDesciption, ProgressComponentWeight" strSQL= strSQL + " FROM dbo.ProgressReportComponent WHERE ModuleCode = " & varModulelD strSQL= strSQL + " ORDER BY ProgressComponentDesciption " 'response.write(strSQL) Set Re2 = conn.Execute(strSQL) %> <select name="formCategory" size="1" style="width:200;COLOR:#669966;" onChange="CheckRequiredText() "> <% strSQL3= " SELECT ProgressReportCommentsTypeCode, ProgressReportCommentsTypeDescription" strSQL3= strSQL3 + " FROM dbo.ProgressReportCommentType WHERE ModuleCode = " & varModulelD Set Re3 = conn.Execute(strSQL3) do until Re3.EOF response.write "<option value= " & Re3("ProgressReportCommentsTypeCode") & "> " & Re3("ProgressReportCommentsTypeDescription") & "</option>" Re3.MoveNext loop Re3.close Set Re3 = Nothing %> </select> <font color="red">This is my CheckRequiredText() function. Everything is working on my function except when it connects to the database. That is when I get the error message "Error 424 Object Required" I can't figure out why my connection string is not working.</font id="red"> <SCRIPT LANGUAGE = "VBScript"> <!-- Private Function CheckRequiredText() MsgBox "The " & Form.formCategory.options(Form.formCategory.select edIndex).value & " was the selected code." varTypeCode= Form.formCategory.options(Form.formCategory.select edIndex).value strSQL4=" SELECT ProgressReportCommentCode, ProgressReportCommentTypeCode, ProgressReportCommentDescription" StrSQL4=strSQL4 + " FROM dbo.ProgressReportComment WHERE ProgressReportCommentTypeCode = " & varTypeCode On Error Resume Next MsgBox StrSQL4 Set Re4 = conn.Execute(strSQL4) MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description End Function ---------------------------- <font color="red">This is the value of my conn</font id="red"> Set conn = Server.CreateObjectADODB.Connection) conn.ConnectionTimeout = 30 conn.CommandTimeout = 30 conn.Open (Provider=SQLOLEDB;UID=ourUserID;Password=ourPassw ord;Initial Catalog=ourCatalog;Data Source=ourdatabasename and location) Can someone help me figure out the solution to my problem. |
|
|
|
|||
|
is varTypeCode an integer or string?
|
|
|||
|
Hi
Thanks for replying I varTypeCode is an integer as it was derived from the index value of a SELECT field. Terry <blockquote id="quote"><font size="1" face="geneva, verdana, arial" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by D3mon is varTypeCode an integer or string? <hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> |
|
|||
|
<s>OK, did you define Re4 as a recordset?</s>
There's your problem, you appear to be trying to access your database from client-side script. While this may be possible it would mean revealing your DB connection details in the client-side code - a potentially fatal mistake. |
|
||||
|
this code:-
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
if you use Runat="server" though, you won't be able to use a msgbox...
|
|
|||
|
Thanks
<blockquote id="quote"><font size="1" face="geneva, verdana, arial" id="quote">quote:<hr height="1" noshade id="quote">Originally posted by D3mon if you use Runat="server" though, you won't be able to use a msgbox... <hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> |
![]() |
| Tags |
| help, asp, procedure, vbscript |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Update two tables using Stored Procedure in SQL | Wheatus7 | Databases | 5 | Jul 1st, 2007 17:42 |
| VBScript Hell | moojoo | Other Programming Languages | 1 | Oct 10th, 2006 20:44 |
| URLDecode - The one - ASP/VBScript | spinal007 | Classic ASP | 0 | Aug 9th, 2006 13:41 |
| VBScript.... | courtjester | Classic ASP | 3 | Feb 3rd, 2004 09:13 |