473,714 Members | 3,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADODB.Connectio n in an ASP Page VBScript subroutine

18 New Member
I am working on creating a new ASP page that needs to populate a Select object after three other fields have been populated. I am calling a VBScript subroutine to do this from the OnClick for the specified Select object. The problem I am having is that the code will not create the ADODB Connection. I know the username and password work and if I were to create the connection in the main body of loading the page it would connect. From everything I have read and found on the internet I should be able to do this via the subroutine but can not figure out why it is not working. Any help on this would be creately appreciated.

Expand|Select|Wrap|Line Numbers
  1. Sub LoadPoList(FieldNo,strConnect)
  3.     Do until frmAddInvoice("cmbConsPO" & FieldNo).length = 0
  4.         frmAddInvoice("cmbConsPO" & FieldNo).remove 0
  5.     loop
  7.     Max = FieldNo + 5
  8.     value = FieldNo
  10.     strConn  = "Driver={SQL Server}; Server=" & MyServer  & ";Database=" & MyDB  & "; Uid=" & MyUserName & ";"
  11.     strConn = strConn &  " Pwd=" & MyPassWord & ";"
  12.     Set myConn = Server.CreateObject("ADODB.Connection")
  13.     myConn.Open strConn
  15.     UseOwner = Trim(document.frmAddInvoice.cmbOwner.value)
  16.     UseDestination = Trim(document.frmAddInvoice.cmbDestination.value)
  17.     UsePart = Trim(document.all("txtGTW" & FieldNo).Value)
  18.     strSQL = "SELECT DISTINCT ReferenceID FROM InventoryTransactions WHERE (TransactionType = 'Shipment') AND (Invoice IS NULL) AND (Destination = '" & UseDestination & "') AND (COID = " & UseOwner & ") AND (PartNumber = '" & UsePart & "')"
  19.     set rds =  conn.execute(strSQL, dbOpenDynaset)
  20.     Do While not rds.eof
  21.     AddToDropDown(FieldNo,"")
  22.     Do While Not rds.eof
  23.         AddToDropDown(FieldNo,ReferenceID)
  24.         rds.movenext
  25.     loop
  26.     rds.close
  27.     set rds = nothing
  28.     set myConn = nothing
  29. End Sub
Sep 7 '07 #1
3 3752
3,406 Recognized Expert Specialist
so it's giving you an error at the setMyconn line? Everything looks good to me there. Try writing out the strConn variable to see if it looks right.

Sep 10 '07 #2
18 New Member
Yes I have tried doing that and it does look correct.

I have talked with a co-worker and he seems to think it is because the manipulation of recordsets has to be done on the server side and NOT the client side. Do you know if this is correct? If this is correct do you know if it is possible to create the recordset on the server and then pass back the whole recordset as a variable back to the client side so it can be manipulated?
Sep 10 '07 #3
3,406 Recognized Expert Specialist
Yes I have tried doing that and it does look correct.

I have talked with a co-worker and he seems to think it is because the manipulation of recordsets has to be done on the server side and NOT the client side. Do you know if this is correct? If this is correct do you know if it is possible to create the recordset on the server and then pass back the whole recordset as a variable back to the client side so it can be manipulated?
Ah, yes. I thought you were using this server-side. All ASP scripts run exclusively on the server and trying to get them to work on the client will fail in one way or another.

Probably the easiest way to do this nowadays is to open the whole recordset and export it as an XML file which can be manipulated ad nauseum by different components and even browsers. It's hard for me to know what you might want to manipulate on the client-side, since I am used to doing all my manipulations on the server, but this is doable. Let me know if this points you in the right direction.

Sep 10 '07 #4

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

Similar topics

by: Bina Desai | last post by:
I get the following error: Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '' /myweb4/authorised_user_page.asp, line 70 and line 70 of my code is: <% rsCheckUser1.Open strSQL1, strcon1 %> Here is the full code:
by: Patrick | last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can 1) Either set under IIS Manager-> Any specific Virtual Directory-> Configuration->Options->ASP Script timeout for all pages within that directory OR 2) Within a specific page, set the timeout as per http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/vbob246s.htm e.g. <% Server.ScriptTimeout = 1 %> and that the value in...
by: ching | last post by:
Hi I've seen many posting in the web on the similar problem I encountered below, but I still couldn't find any solution to it. I built an ASP.NET application, which is migrated from ASP. the error message is : Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
by: Steven Baeten | last post by:
Hi All, I'm running a webpage-application where, in a aspx-page,a udl is called in vbscript in an xsl-stylesheet to access a database. When I want to execute this, I receive following error ADODB.Connection Safety settings on this computer prohibit accessing a data
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the original question, the subject line is: ADODB.NET and "Access Denied" I have an ASP.NET page writtein in VB that uses ADODB. I just had to
by: Joe Befumo | last post by:
I'm getting the following error in my application: Compiler Error Message: BC30002: Type 'ADODB.Connection' is not defined. Source Error: Line 112: if(Request.Form("HdnQuestionCount") = 0) thenLine 113:Line 114: Dim objDataConn as ADODB.ConnectionLine 115: Dim objRSList as
by: fniles | last post by:
I am using VB.NET 2003 and SQL 2005. To use connection pooling and avoid the error "There is already an open DataReader associated with this Connection which must be closed first." , I understand that I want to release/close connections in a timely fashion. What I do is I declare the SqlClient.SqlConnection variable as a local variable inside my subroutine (instead of a global variable). Right before I Fill the dataset I open the...
by: Shades799 | last post by:
Hi All, I was wondering if any of you could help me with a very difficult problem that I am having. I have an ASP site that works with an Oracle database using an ADODB connection. This connection is stored in a .dll file. This site had been working fine. However recently we upgraded our Oracle database from 9i to 10g and ever since then we have been having serious performance problems with this site only. The website works fine...
by: rocketboy2000 | last post by:
could anyone provide me with some simple example code of asp classic calling adodb? specifically, i'd like the code to: - call a couple of stored procedures that have optional parameters - share a connection over the two calls any assistance greatly appreciated and thanks in advance.
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 most users, this new feature is actually very convenient. If you want to control the update process,...
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.