?
Solved

RDO Connection problem

Posted on 2001-07-11
6
Medium Priority
?
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 600 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 53

Expert Comment

by:Ryan Chong
ID: 6276862
Hi kirtirani,

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

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

800 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