connect sql using vb

how can i connect ms sql by vb using ADODB. Please help
Who is Participating?
leclairmConnect With a Mentor Commented:
dim oConn as adodb.connection
dim rs as adodb.recordset
set oConn = new adodb.connection
set rs = new adodb.recordset "Provider=sqloledb;Data Source=dbServer;Initial Catalog=YourDb;User Id=YourUser;Password=YourPassword;" "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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.