473,406 Members | 2,633 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.

VB database connection problem

2
i am facing a database connectiion problem that i have writen code with connect to the database using ADODB , and i am sure that the connection is made an execution of query can be done succefully with some common query
such as "select * form report"
however , when i excute a stored procedure error prompt out with

Runtime Error "3021"
either BOF or EOF is True,or the current record has been deleted

I am sure that there is data in the database and the query work fine if i use the SqlAdv to run it.and i am using windowxp SP2 which has mdac 2.8

could anyone tell me how to fix the problem?

the below is my code
Expand|Select|Wrap|Line Numbers
  1. Private Sub execute_Click()
  2. Dim Connection As New ADODB.Connection
  3. Dim Rs As New ADODB.Recordset
  4. Dim Bs As New ADODB.Recordset
  5. Dim ExApp As New Excel.Application
  6. Dim ExWk As New Excel.Workbook
  7. Dim EXWs As New Excel.Worksheet
  8. Dim EXRs As Excel.Range
  9. Dim sql As String
  10.  
  11. Set Connection = New ADODB.Connection
  12. Connection.Open ("DSN=RET_DATA;UID=user;PWD=password")
  13.  
  14. Set Rs = Connection.execute("sp_report 20071014,20071015")
  15.  
  16. Rs.MoveFirst
  17.  
  18. ExApp.Visible = True
  19. Set ExWk = ExApp.Workbooks.Open("C:\Documents and Settings\ncht\Desktop\test2.xls")
  20. Set EXWs = ExApp.Worksheets("Sheet2")
  21. Set EXRs = ExApp.Range("A1")
  22.  
  23. EXRs.CopyFromRecordset Rs
  24.  
  25. Rs.Close
  26. End Sub
  27.  
Oct 24 '07 #1
2 1518
debasisdas
8,127 Expert 4TB
Is the procedure returning any value when executed independently at database level ?
Oct 24 '07 #2
ncht
2
the procedure does return the field and the properties when i run the debug mode and add watch on the result set yet both the BOF and EOF set to True



and when i execute another query it can also extract the recordset into the excel file...

thanks for your reply ^^
Oct 24 '07 #3

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

Similar topics

14
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
7
by: News | last post by:
Hello, I have to build a program with the future in mind and I need a bit of guidance from a guru or two. My program will start as a multi-user Windows Application built with VB.Net and using an...
2
by: Ron St-Pierre | last post by:
We're developing a java app and are using postgres as the database. On our dev server I started the app, closed it, but the java process was still open so I killed it, which caused the above error....
10
by: mjf | last post by:
Hello, We made a backup image file for a database on one machine (A), and we restored the database on another machine (B), using the backup image file. Everything went fine. But when we try to...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
5
by: Sam | last post by:
Hi all, I have a process which first pulls one time all application IDs from a database and stores them in a table(this process works fine everytime). I then loop through the table, one at a...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
8
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.