In Vb we can connect to all the databases like SQL 2000/SQL 2005,Oracle,Access.
Out of the given databses we can connect to which databases.

Secondly,told me dat if I want to connect to SQL-any version(2000/2005), To connect to the database i go to
Control Panel-->Admintrative Tools-->Data sources(ODBC)-->ODBC Data source Administrator Screen cones,4m which I click on ADD Button--> Now tell me to coonect to SQL,From CREATE NEW DATASOUCE, which option I have to choose.

Plz Reply early,Its urgent.

Recommended Answers

All 7 Replies

I think you are a new poster here. so there is something that i want to tell you and you should know this too.

1. before posting any thread please refer to the forum rules.
2. after posting a thread wait for some time to let someone to give you an appropriate reply. look this is a free forum. so everyone is participating here by spending a lot of his/her valuable time. so donot expect any quick reply.
3. before posting any other thread regarding the same topic atleast visit your existing thread to see whether you got any reply or not. don't post the same thread/same question again n again.
4. think ten times before you post a reply as well as a new thread.
5. this is a request please keep this forum clean and well-organized as far as possible.

you have posted three threads with this same topic. please don't ever try to do this again.check your previous threads i have already made some replies there. not only me others might be replied there.

ok....

regards
Shouvik

As u required a sql connectivity you can select the SQL SERVER
Specify the name and the description that should be identifier

Next Specify the server name on which the sql is installed

click on next button

if u are connection the sql server on same machine ie vb and sql on same machine select
with windows nt authentication

if it is on other machine
one is haveing sql and second is haveing the sql then select sql auth...
Login name will be sa
password [password is blank so leave it blank]
click on next
click on
Change to default database
selec the database you want to connect
finally click on finish


OTHER AND EASIEST WAY OF CONNECTION


1.Create a blank notepad
2. save the file with mycon.udl [do not enter even a single character]
3. close the notepad
4. U will find the icon of the file is not notepad but so other
5. double click on the file
5. it will give u wizard
7. click on provider tab
8. Select Microsoft oledb for sql server
9 . click on next button
10. it will ask you the server name , type the servername of sql server
11. select Use window nt integrated security
12. Select the database
13. Click on test button ( it shoud show tested successfully , if not

confirm the server name )
14 Finally click on the finish button


now right click on the mycon.udl file and open it with the notepad
you will see some text is generated

copy the text from provider till end

now in vb
dim con as new adodb.connection
private sub form_load()
con.connectionstring = [paste the string that you have copied from

mycon.udl ]
con.open

your connection is ready to use

hi,nileshsarode, I had done all the steps of connectivity.

One thing ,After clicking on Test Connection button,Msgbox is displayed that shows Test Connection Successed.
After that u write click on Finish Button, instead there is no finish button on that screen,I click on cancel button.

Second thing, When I open the save with notepad,no text is generated,it is still empty.

you saw that blank because you clicked on the cancel button. after testing your connection click on the OK button to save all settings.
now right click on the udl file->select open with->select notepad

you should look similar content like the following if you successfully build up a connection using a UDL file :-

[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=bs;Initial Catalog=BILLING_SYSTEM

now you can see three lines in that file. among these the last/third line is your connection string which you need to pass from your vb6 application through an ado connection object in order to communicate with your database.

one more thing, regarding connections :-
in the connection tab of the data link properties dialog box (displayed when you double click on the udl file) you can write or skip writing the server name. whether you need to write/select a server name or not depends on the location of your server.
if your sql server is installed in your local machine (means the same machine from where you are running your front-end application) you don't need to write/select any server name. you need to mention it when the sql server is installed in some other remote node and your application is trying to connect to it from your local machine.
now after that, you must select an authentication mode which are of two types :-
1. Windows NT authentication :- select this mode if the sql server and your vb6 application reside in the same machine.
2. Sql Server Authentication :- you must select this option if your sql server is installed in a remote machine (any node connected in the network but not the same one where your application resides).

now sometimes if you have created any logins/users for your database then you can select the second option for authentication in case you are connecting to the local sql server. but i think you can't use that. because sql server 2000 doesn't support Sql Server Authentication mode while connecting to a local server. this facility is available in earlier versions such as Sql Server 7.0 .

I hope now your problems will be solved.

regards
Shouvik

I understood.
I have SQL Server 2000/2005 installed on my computer(Same m/c).
If I do not give server name in Connection name,then by default it takes SQL 2005 version,means higher version. Is it so??

do you have both versions (2000 and 2005) installed on your machine or only one of them?

if you have it installed on local server then you don't need to write anything in the server space.

yes, it is the rule. always higher version gets preference by your OS.

regards
Shouvik

so, as you said i think you should go for Windows Authentication mode.

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.