Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic and SQL

Status
Not open for further replies.
Feb 11, 2004
8
0
0
US
I am wanting to design a Database that can be accessed from any computer on our WAN. I started with Access but it was too slow accross the WAN, So I went to SQL and used Access to link to the SQL server. It works OK but some of our workstations dont have office, so my thoughts are to use Visual Basic to create a program that can work with the SQL database. I have some exp with Visual Basic and I am using Visual Basic 6. How do I link the program to the SQL Server? This database is pretty simple so I dont think that makeing the program will be very hard once I get the data flowing.

Thank You
 
The alternative is, if you have the Offive Development Kit, is to compile create an install for your Access Database, which can install the runtime files on the PC's and you wont need a license to run the app then.
 
A simplistic "LINK" would be to create LINKE in an Access (.MDB) database to the SQL tables and then just reference (Open) the .MDB from VB. Somewhat(?) inefficient, of course, but sure is :simple".




MichaelRed
mlred@verizon.net

 
Use an oledb connection and use ADO. Simple example.

Dim cn As New ADODB.Connection, sql1 As String
Dim rs As New ADODB.Recordset, connString As String
connString = "provider=SQLOLEDB.1;" & _
"User ID=sa;Initial Catalog=northwind;" & _
"Data Source=bigtuna;" & _
"Persist Security Info=False"

cn.ConnectionString = connString
cn.Open

'-- return a recordset
sql1 = "select * from mytable"
rs.Open sql1, cn, 3, 3
If not rs.EOF then
' got records
else
' got NO records
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top