?
Solved

connect sql using vb

Posted on 2006-06-30
1
Medium Priority
?
263 Views
Last Modified: 2013-11-23
how can i connect ms sql by vb using ADODB. Please help
0
Comment
Question by:ajaypappan
[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
1 Comment
 
LVL 11

Accepted Solution

by:
leclairm earned 500 total points
ID: 17018090
dim oConn as adodb.connection
dim rs as adodb.recordset
set oConn = new adodb.connection
set rs = new adodb.recordset
oconn.open "Provider=sqloledb;Data Source=dbServer;Initial Catalog=YourDb;User Id=YourUser;Password=YourPassword;"
rs.open "select * from yourtable", oConn

if not rs.eof and not rs.bof then
   do some processing...
end if


Don't forget to set your reference to the ado library.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 Month11 days, 14 hours left to enroll

752 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