Correction ....
.ConnectionString = "Provider=SQLOLEDB;Data Source=YOURSQLSERVERNAME;I
Example:
.ConnectionString = "Provider=SQLOLEDB;Data Source=Server1;Initial Catalog=master"
Main Topics
Browse All TopicsHi,
Running VB 2008 Express and would programmatically write a connection to a sql database.
Will I also need to reference something?
VB6 would be something like this but not sure about VB 2008.
Dim rs as New ADODB.Recordset
Dim Conn As New ADODB.Connection
Public Sub DBConnect()
With
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OL
.Open
End With
rs.Open "SELECT * FROM MT",Conn,adOpenDynamic,adL
End Sub
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
VB 2008 uses ADO.NET, which I believe is more different in terms of functionality than ADO 2.8.
However, you could try the "late binding" method and see if VB 2008 likes it:
Dim rs As Object
Dim Conn As Object
Set rs = CreateObject("ADODB.Record
Set Conn = CreateObject("ADODB.Connec
NOTE: The only draw-back with "late binding" is that the handy IntelliSense feature will not be available.
I know this is late but...
Is the DB you're trying to connect to on your local PC? If not, this is actually by design. The IDE is crippled in VS 2008 Express to only connect to local DB's in both the C# and VB flavors. VWD 2008 Express has no such limitation however since your DB is not likely to reside on your Web server.
You can DL the full-blown VS 2008 package from MIcrosoft now. It is fully-functional but limited to only 90-days. See if you can connect with your code then. If so, then you know it is an Express hang-up.
Business Accounts
Answer for Membership
by: jkaiosPosted on 2007-12-12 at 12:42:07ID: 20459979
SQL Connnection String:
nitial Catalog=YOURSQLDATABASE"
.ConnectionString = "Provider=Microsoft SQL Server;Data Source=YOURSQLSERVERNAME;I
Example:
.ConnectionString = "Provider=Microsoft SQL Server;Data Source=Server1;Initial Catalog=master"