hi ... can someone help me on connecting MSsql 2000 to vb6 ...i've been searching google but they always point me to this site .. http://www.connectionstrings.com/
i dunno how to set up this strings in vb since im new to vb... :( please help

Recommended Answers

All 9 Replies

http://www.connectionstrings.com/sql-server#p6

Probably the SQL OLEDB string is probably what you're looking for.

Get your SQL Server up and running first. Add a reference to the Microsoft ActiveX Recordset 2.x library in your project.

Instantiate your ActiveX Database Objects (ADODB) as follows:

Private rst as ADODB.Recordset
Private cn as ADODB.Connection


Private Sub Form_Load()
set rst = new ADODB.Recordset
set cn = new ADODB.Connection

cn.ConnectionString = ' Your Connection string

rst.open ' your recordset 
End Sub

You need to use ADO library in VB 6.

Read more here and here.

uh..ic thankzz ...but i had a problem..

why i get this error:

[DBNETLIB]ConnectionOpen(Connect()).]SQL Server does not exist or access denied.


btw this is my code:

Option Explicit
Dim MyConnObj As New ADODB.Connection
Dim myRecSet As New ADODB.Recordset

Private Sub Form_Load()

MyConnObj.Open _
"Provider = sqloledb;" & _
"Data Source=MULTIFAC-4659A9;" & _
"Initial Catalog=John1;" & _
"User ID=sa;" & _
"Password=p@ssW0rd;"

End Sub


uhh btw .. does sql had a default username and password? ..coz i think i didnt have a username and password

Try messing around with the Data Environment View.

From the View Menu choose Data View Window

Click on the second icon to add a Data Environment. You should then see a
Connection1 in Data Environment View frame.

Right Click on the Connection1 icon and choose the Properties Menu. At this point you should be able to figure out what settings to use if your SQL server is properly set up. If you still have problems, you need to read through the SQL documentation on how to setup your connection on your machine.

You don't need to use a Data Environment. But it's useful to teach you how to properly set up the parameters to use your SQL Server.

uhh kk... ill try and see what can i do...

uhh kk... ill try and see what can i do...

Usually, there's a section in your Sequel Server Menu section that shows you how to set up your passwords. If you'll read the Help Menu for your SQL Server 2000, look for the section that deals with setting up a connection.

Apparently, you haven't done your homework. You need to do some digging.

ok thankzz btw

No problem. The way I learned how to hook up to SQL Server was first in SQL Server itself--outside the VB6 environment.

It's really hard to jump into the fire without knowing where or how you're going to land. Once you have some experience setting up the SQL environment with a database, then you should be able to recognize which connection strings to use and the proper parameters. As far as I recall, it wasn't that hard. I believe they had a quick start or quick set up section in the SQL Server help section. Should provide all you need to know for setting up your vb6 environment.

No problem. The way I learned how to hook up to SQL Server was first in SQL Server itself--outside the VB6 environment.

It's really hard to jump into the fire without knowing where or how you're going to land. Once you have some experience setting up the SQL environment with a database, then you should be able to recognize which connection strings to use and the proper parameters. As far as I recall, it wasn't that hard. I believe they had a quick start or quick set up section in the SQL Server help section. Should provide all you need to know for setting up your vb6 environment.

thankzz btw i connected it already...thankz for ya help

and btw ....I HATE "MSSQL so much" the reason ive wasted my time on this LAME server is my work .. thankss ..another info gathered :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.