473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

SQL Server / Access commands/recordsets

zachster17
Hey everyone,

I wasn't sure if this should go under SQL Server or Access since it is a hybrid or both.

I'm having a problem using the ADODB.Command and Recordset objects in Access to connect to SQL Server commands. I'm used to writing code to conenct to SQL in VBA (in Access) a certain way, and I recently changed to a new place where they use a different SQL Server among other things.

Anyways, the way I used to write code using the ADODB.Command and ADODB.Recordset isn't working...

I have a stored procedure that has 1 parameter and I'm calling it this way:

Expand|Select|Wrap|Line Numbers
  1.     Set cmdNetwork = New ADODB.Command
  2.     With cmdNetwork
  3.         .CommandType = adCmdStoredProc
  4.         .CommandText = "sp_DIS_ListNetworks"
  5.         .Parameters.Append .CreateParameter("@NetworkID", adInteger, adParamInput)
  6.         .Parameters("@NetworkID").Value = CInt(lstNetworks.Value)
  7.         .ActiveConnection = CurrentProject.Connection
  8.     End With
  9.  
  10.     'setup recordset
  11.     Set rsNetwork = New ADODB.Recordset
  12.     rsNetwork.Open cmdNetwork.Execute, CurrentProject.Connection, adOpenDynamic, adLockReadOnly
  13.  
Before, I didn't have the .Parameters.Append .CreateParameter, but it was saying that the parameter couldn't be found when I didn't have it. Before, I cold just put .Parameters("@ParemeterName") = Value with no problems but now it doesn't work.

Also, when it I go to open the recordset (rsNetwork.Open) I get an error (Arguments of the wrong type, are out of acceptable range, or are in conflict with one another.) no matter what I set the cursor and lock method to. I don't get an error when I leave off all arguments after .Execute.

Would anyone be able to refresh me on why these errors are happening?

Thank you!

Zach
Jul 14 '08 #1
1 1184
ck9663
2,878 Expert 2GB
You need to test if your connection is working first.

This is more of an Access problem than a SQL problem.

Try running your script up to the connection portion. Test the connection (use a prompt or messagebox). Then close the connection. If you can properly connect, then test your recordset by executing a simple select and storing it (and accessing it) on a recordset variable. Then next step is try your recordset with your stored proc.

By the time you're on the last portion, you'll know what your problems are. It's called isolation.

-- CK
Jul 14 '08 #2

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

Similar topics

4
by: ^CeFoS^ | last post by:
Hello to everybody, I've done an application that draws in a frame the trajectory of a robot. The robot position is readed through the serial port, and several commands are wrote through the...
6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
2
by: Takuon Soho | last post by:
I'm taking over an SQL Server database which is often updated with data from an Access database. Knowing little about either, this simple task has become a challenge. I'm told that the...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
29
by: Mark B | last post by:
We have an Access app (quite big) at www.orbisoft.com/download. We have had requests by potential users to have it converted to an SQL version for them since there corporate policy excludes them...
14
by: diskoduro | last post by:
Hi!! Years ago I built a database to control the production of a little factory. The users wanted to work in a Windows Net workgroup so I created an mdb with all the tables and data an after...
1
by: B Moor | last post by:
Hello, I am quite bogged down with this problem and would like some tips/help if any one has any. Thanks in advance. The Problem ----------- This system initially seemed quite stable for...
64
by: John | last post by:
Hi What future does access have after the release of vs 2005/sql 2005? MS doesn't seem to have done anything major with access lately and presumably hoping that everyone migrates to vs/sql. ...
14
by: JonOle | last post by:
In Access 2007 I have a main form with several subforms. All forms are unbound, and the recordsets for the forms are set during the OnOpen-event in the main-form. I use ADO and OleDB to connect to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

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.