Solved

RDO Connection problem

Posted on 2001-07-11
6
496 Views
Last Modified: 2008-02-01
Hi All,

I am very new to VB and now I have started coding in VB. I have to write an application using SQL server as a backend and RDO connection. I am having difficulty in writing the code for RDO. Can anyone help me and can give me the code for establishing the connection and executing the query with RDO thru VB. I need it urgently.

Kirti
0
Comment
Question by:kirtirani
6 Comments
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 6275532
Hi kirtirani,

This class demo maybe can help you:

Demonstrates the creation of Master/Detail form using an RDO connection, also helps understand the object oriented programming concepts in VB.

http://www.vbcode.com/code/MDForm.zip

Anyway, you can use the RDO Control in component, follow the wizard provided, it is much easier stuff.

Basically, RDO is perform as well as the ADO.

'Hope will help.
0
 

Author Comment

by:kirtirani
ID: 6275665
Hi ryancys,
thanx for ur program but the thing is I don't want to use the RDO control. and i can use ADO also its upto me. so please suggest which one is better and provide some more useful stuff.
kirti
0
 

Expert Comment

by:Matdone
ID: 6275776
Here is the code I use. It is in ADO. This will retrive the information from the table. You can use a DSNless connection or one that uses a DSN.

Sub GetSql()
Dim RSSQL As ADODB.Recordset

'This is the dsnless connection
ConnectStrSQL = "Provider=SQLOLEDB.1; Network Library=dbmssocn;Password=Password;User ID=UserName;Initial Catalog=DatabaseName;Data Source=ServerName;"

'This is the DSN connection string. this is the easiest method
ConnectStrSQL = "DSN=Pubs;UID=sa;PWD=pwd;"

'Open Sql Database for updating
Set RSSQL = New ADODB.Recordset
RSSQL.ActiveConnection = ConnectStrSQL
RSSQL.CursorType = adOpenKeyset
RSSQL.LockType = adLockOptimistic
RSSQL.Open "Select * from table"

Hope this helps. Read up on ADO at msdn.microsoft.com/vbasic/technical/articles/ado20/default.asp

Matt
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Expert Comment

by:jrspano
ID: 6276824
if you have the choice definately use ado instead of rdo.  MS as quit releasing new rdo stuff and don't really support it anymore.
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6276852
also the above way shown is slow as you have to reconnect to the db every time you want the recordset you should use a connection object if you have to get a bunch of recordsets

ex

dim cn as adodb.connection
dim rs1 as adodb.recordset
dim rs2 as adodb.recordset

set cn = new adodb.connection
set rs1 = new adodb.connection
set rs2 = new adodb.connection

cn.connectionstring = "DSN=mydsn" 'or use a dsn less one
cn.open

dim sql as string
dim sql2 as string
sql = "sql query"
sql2 = "sql2 query"

rs1.open sql, cn, adopenstatic, adlockreadonly
rs2.open sql2, cn, adopenstatic, adlockreadonly

do stuff with rs's

rs1.close
rs2.close
cn.close

set rs1 = nohting
set rs2 = nothing
set cn = nothing
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 6276862
Hi kirtirani,

This might be useful: http://www.able-consulting.com/tech.htm
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now