473,473 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ADO Data Control in VB 6.0

Hello:

I am building a program in Visual Basic 6.0. (Op Sys: Windows XP 2002
Service Pack 2)

I placed an AOD Data Control on a form...and a data Grid. I bound the data
grid to the data control. Then used the following code to populate the data
control ...and thus, the grid:

With datPos
.ConnectionString = stConn
.RecordSource = sPosSQL
.Refresh
End With

stConn is the connection string
sPosSQL is the SQL Statement
Then I refresh the data control

I used the exact same language on a different form it the same program...and
it works fine. I put it on this new form and I get the following error:
[ADODC]: Unknown error. [ADO];
Press "OK" and I get:
Run-time error '-2147467259 (80004005)'"
Method 'Refresh' of object "IAdodc' failed

To check out my SQL and be sure there was no error. I defined a
DAO.Recordset. and opened the recordset using set MyRST =
SUDB.OpenRecordset(sPosSQL) and it opens... etc.

Does anyone have any idea why I'm getting that "unknown" error with the
program works elsewhere.

Thanks...

JP
Oct 27 '06 #1
7 28333

"Joe-Paul Robb, Jr." <jp****@seniortrans.comskrev i meddelandet
news:71u0h.51$mX4.14@trndny03...
Hello:

I am building a program in Visual Basic 6.0. (Op Sys: Windows XP 2002
Service Pack 2)

I placed an AOD Data Control on a form...and a data Grid. I bound the
data
grid to the data control. Then used the following code to populate the
data
control ...and thus, the grid:

With datPos
.ConnectionString = stConn
.RecordSource = sPosSQL
.Refresh
End With

stConn is the connection string
sPosSQL is the SQL Statement
Then I refresh the data control

I used the exact same language on a different form it the same
program...and
it works fine. I put it on this new form and I get the following error:
[ADODC]: Unknown error. [ADO];
Press "OK" and I get:
Run-time error '-2147467259 (80004005)'"
Method 'Refresh' of object "IAdodc' failed

To check out my SQL and be sure there was no error. I defined a
DAO.Recordset. and opened the recordset using set MyRST =
SUDB.OpenRecordset(sPosSQL) and it opens... etc.

Does anyone have any idea why I'm getting that "unknown" error with the
program works elsewhere.

Thanks...

JP

If the ADO control is on another Form, are you referencing the control on
the correct path (Form)?

/Henning
Oct 28 '06 #2

"Henning" <co***********@coldmail.comwrote in message
news:45***********************@news3.bahnhof.se...
>
"Joe-Paul Robb, Jr." <jp****@seniortrans.comskrev i meddelandet
news:71u0h.51$mX4.14@trndny03...
Hello:

I am building a program in Visual Basic 6.0. (Op Sys: Windows XP 2002
Service Pack 2)

I placed an AOD Data Control on a form...and a data Grid. I bound the
data
grid to the data control. Then used the following code to populate the
data
control ...and thus, the grid:

With datPos
.ConnectionString = stConn
.RecordSource = sPosSQL
.Refresh
End With

stConn is the connection string
sPosSQL is the SQL Statement
Then I refresh the data control

I used the exact same language on a different form it the same
program...and
it works fine. I put it on this new form and I get the following error:
[ADODC]: Unknown error. [ADO];
Press "OK" and I get:
Run-time error '-2147467259 (80004005)'"
Method 'Refresh' of object "IAdodc' failed

To check out my SQL and be sure there was no error. I defined a
DAO.Recordset. and opened the recordset using set MyRST =
SUDB.OpenRecordset(sPosSQL) and it opens... etc.

Does anyone have any idea why I'm getting that "unknown" error with the
program works elsewhere.

Thanks...

JP
If the ADO control is on another Form, are you referencing the control on
the correct path (Form)?

/Henning
DAO.Recordset with ADO control ?
Oct 29 '06 #3
JP
Yes, I'm referring to the correct control... It is on a form...and called
datPOS. The other control on the other form is "datDep"... so I am
referring to the correct control
"Henning" <co***********@coldmail.comwrote in message
news:45***********************@news3.bahnhof.se...
>
"Joe-Paul Robb, Jr." <jp****@seniortrans.comskrev i meddelandet
news:71u0h.51$mX4.14@trndny03...
>Hello:

I am building a program in Visual Basic 6.0. (Op Sys: Windows XP 2002
Service Pack 2)

I placed an AOD Data Control on a form...and a data Grid. I bound the
data
>grid to the data control. Then used the following code to populate the
data
>control ...and thus, the grid:

With datPos
.ConnectionString = stConn
.RecordSource = sPosSQL
.Refresh
End With

stConn is the connection string
sPosSQL is the SQL Statement
Then I refresh the data control

I used the exact same language on a different form it the same
program...and
>it works fine. I put it on this new form and I get the following error:
[ADODC]: Unknown error. [ADO];
Press "OK" and I get:
Run-time error '-2147467259 (80004005)'"
Method 'Refresh' of object "IAdodc' failed

To check out my SQL and be sure there was no error. I defined a
DAO.Recordset. and opened the recordset using set MyRST =
SUDB.OpenRecordset(sPosSQL) and it opens... etc.

Does anyone have any idea why I'm getting that "unknown" error with the
program works elsewhere.

Thanks...

JP

If the ADO control is on another Form, are you referencing the control on
the correct path (Form)?

/Henning


Oct 30 '06 #4
JP
Yes... using a DAO Recordset and setting it to a DAO Recordset. I can just
define it as a "Recordset" rather than a "DAO.Recordset" and get the same
thing. The control on the other form has a recordset "DAO.Recordset" and it
is set to the control and works fine.

"Geoff" <No****@No.comwrote in message
news:45***********************@news.zen.co.uk...
>
"Henning" <co***********@coldmail.comwrote in message
news:45***********************@news3.bahnhof.se...
>>
"Joe-Paul Robb, Jr." <jp****@seniortrans.comskrev i meddelandet
news:71u0h.51$mX4.14@trndny03...
Hello:

I am building a program in Visual Basic 6.0. (Op Sys: Windows XP 2002
Service Pack 2)

I placed an AOD Data Control on a form...and a data Grid. I bound the
data
grid to the data control. Then used the following code to populate the
data
control ...and thus, the grid:

With datPos
.ConnectionString = stConn
.RecordSource = sPosSQL
.Refresh
End With

stConn is the connection string
sPosSQL is the SQL Statement
Then I refresh the data control

I used the exact same language on a different form it the same
program...and
it works fine. I put it on this new form and I get the following
error:
[ADODC]: Unknown error. [ADO];
Press "OK" and I get:
Run-time error '-2147467259 (80004005)'"
Method 'Refresh' of object "IAdodc' failed

To check out my SQL and be sure there was no error. I defined a
DAO.Recordset. and opened the recordset using set MyRST =
SUDB.OpenRecordset(sPosSQL) and it opens... etc.

Does anyone have any idea why I'm getting that "unknown" error with the
program works elsewhere.

Thanks...

JP

If the ADO control is on another Form, are you referencing the control on
the correct path (Form)?

/Henning
DAO.Recordset with ADO control ?


Oct 30 '06 #5

"JP" <jp****@seniortrans.comwrote in message
news:Ndo1h.2192$B44.827@trndny07...
Yes, I'm referring to the correct control... It is on a form...and called
datPOS. The other control on the other form is "datDep"... so I am
referring to the correct control
Well the ADO data control is designed to work with ADO, not DAO.
Are you sure both forms are using tha ADO control with DAO.
When you hover your mouse over the toolbar .
The DAO dataControl displays DATA1, the ADO displays ADODC.
I suggest you start by using the DATA1 control with DAO.
or ditch the DAO.Recordsets & use ADO.Recordsets with
the ADO Control
Regards G.


Oct 30 '06 #6
JP
Geoff...

The help file shows that the ADO Recordsource can be an SQL Statement.
That's what I've tried to execute. In the example I gave... I ran a DAO
recordset to see if the SQL was correct. It was. The actual code is:

Private Sub GetPositions(lgDeptID As Long, lgLocID As Long)
Dim sPositSQL As String

sPositSQL = "SELECT [Position Table].LocationID, [Position
Table].DepartID, "
sPositSQL = sPositSQL & "[Position Table].Position "
sPositSQL = sPositSQL & "From [Position Table] "
sPositSQL = sPositSQL & "Where ((([Position Table].LocationID) = " &
lgLocID & ") And "
sPositSQL = sPositSQL & "(([Position Table].DepartID) = " & lgDeptID &
")) "
sPositSQL = sPositSQL & "ORDER BY [Position Table].Position; "

With datPosit
.ConnectionString = stConn
.RecordSource = sPositSQL
.Refresh
End With

End Sub

As you can see, there is no DAO here. I'm just trying to put the
"recordsource" (SQL) as the recordset to be used in the control.

I need a grid and am using the DataGrid which requires the ADODC. On my
tool bar, when I run my mouse over the other data control, it says "Data"
and that will not display as an appropriate datasource for the DataGrid.

I'm not using DAO for any ADODC control on any form... I'm using SQL
Statements as the Recordsource.

JP
"Geoff" <No****@No.comwrote in message
news:45**********************@news.zen.co.uk...
>
"JP" <jp****@seniortrans.comwrote in message
news:Ndo1h.2192$B44.827@trndny07...
>Yes, I'm referring to the correct control... It is on a form...and called
datPOS. The other control on the other form is "datDep"... so I am
referring to the correct control
Well the ADO data control is designed to work with ADO, not DAO.
Are you sure both forms are using tha ADO control with DAO.
When you hover your mouse over the toolbar .
The DAO dataControl displays DATA1, the ADO displays ADODC.
I suggest you start by using the DATA1 control with DAO.
or ditch the DAO.Recordsets & use ADO.Recordsets with
the ADO Control
Regards G.


Oct 31 '06 #7

"JP" <jp****@seniortrans.comwrote in message
news:hZK1h.5395$dx4.5294@trndny05...
Geoff...

The help file shows that the ADO Recordsource can be an SQL Statement.
That's what I've tried to execute. In the example I gave... I ran a DAO
recordset to see if the SQL was correct. It was. The actual code is:

Private Sub GetPositions(lgDeptID As Long, lgLocID As Long)
Dim sPositSQL As String

sPositSQL = "SELECT [Position Table].LocationID, [Position
Table].DepartID, "
sPositSQL = sPositSQL & "[Position Table].Position "
sPositSQL = sPositSQL & "From [Position Table] "
sPositSQL = sPositSQL & "Where ((([Position Table].LocationID) = " &
lgLocID & ") And "
sPositSQL = sPositSQL & "(([Position Table].DepartID) = " & lgDeptID &
")) "
sPositSQL = sPositSQL & "ORDER BY [Position Table].Position; "

With datPosit
.ConnectionString = stConn
.RecordSource = sPositSQL
.Refresh
End With

End Sub

As you can see, there is no DAO here. I'm just trying to put the
"recordsource" (SQL) as the recordset to be used in the control.

I need a grid and am using the DataGrid which requires the ADODC. On my
tool bar, when I run my mouse over the other data control, it says "Data"
and that will not display as an appropriate datasource for the DataGrid.

I'm not using DAO for any ADODC control on any form... I'm using SQL
Statements as the Recordsource.

JP
The problem is with your connection string. Perhaps it is opening the
database with 'exclusive' rights or some other restriction?

Try creating one adodb.connection object and assigning that as the
DataSource for each of your Adodcs.

-ralph
Oct 31 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: the_grove_man | last post by:
I guess my question can go in two directions. I create applications that run multiple queries against a database. Generally speaking in the past I have used a Data Control (calling it dat1)...
1
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
2
by: Wysiwyg | last post by:
I was hoping to get some opinions on the efficiency of various methods of reusing the same dropdown list data. Here is the situation: Multiple panels on maintenance pages with TAB menus across...
0
by: Mafuba | last post by:
I'm trying to use data sources with data bound controls on one of my pages that's using a master page. The master page has 2 ContentPlaceHolders, and in my page the data sources are in the first...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: Kristian Frost | last post by:
Hi, I'm just getting started with VB.Net, and I'm having trouble getting the routing around of some of the data straight in my mind, which has led me to the following problem. Basically, I'm...
1
by: Rich | last post by:
Hello, I am trying to use the Reportviewer control. I have been following an example from the web, and the instructions from the help files on set up a ..rdlc and binding it to the reportviewer...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
0
marktang
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,...
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...
1
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...
1
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
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...

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.