Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2008, 02:26 AM
Registered User
 
Join Date: Dec 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Connect SQL Server 2k with VB from DSN and DBQ

Dear Sir / Madam,

Date : 12th February 2008

Hi, I am Ayan Mukherjee, a Programmer seeking for help. Please help me out.

Software Specification : I have Windows 2000 Server with service pack 4, IIS version 5, IE 6 with service pack 6.1.

Working Environment : I have to work for an application with VB6 as front end tool and MS SQL Server 2000 as a database.

I need to develop a DSN for my application, which I have successfully done from the ODBC tab. The DSN name is "Employee". My SQL Server 2000's database name is also "Employee". My SQL Server name is "VK_AYANMUKHERJE".
I am able to connect with SQL Server from VB6 easily at local machine. Please see the code below.

Public Function Connection()

On Error GoTo errcon

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset

Set adoconn = New ADODB.Connection
adoconn.ConnectionString = "Driver={SQL Server};Server=VK_AYANMUKHERJE;Database=Employee;U id=;Pwd=;"
adoconn.Open
adoconn.CursorLocation = adUseClient

Dim sqlstr As String

sqlstr = "select * from emp_details"

rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic

rs.Open sqlstr, adoconn, adOpenDynamic, adLockOptimistic

Set rs = Nothing

Exit Function

errcon:
MsgBox "The error is : " & err.Description & " and the error no. is : " & err.Number, vbCritical, "Connection Error."
Exit Function

End Function

Now the problem is I need to develop the application in such a way that, 1) The Application path i.e. App.Path has to be supplied along with the DSN name and DBQ Name is also required to provide as it is a required that the Registry should have the key values, 2) When the login screen comes, the user is required to provide the Database name, User Id and Password. Means the database has to be found out from the drive. How can I do it?

Please help so that I can start as soon as possible. I am running from pillar to post, but have not got the solution yet. Yours earlier intervention will be highly appreciated.

Please publish it in your esteemed site as soon as possible and it would be very helpful and nice, if you can also send me the solution in mail in my mail id.

Thanking you in anticipation, and hoping for a honorable reply from your kind hands, I remain.

Yours faithfully,

With regards,

Ayan Mukherjee









Similar Threads
Thread Thread Starter Forum Replies Last Post
VB 2005 connect to server 2003 with SQL database Derek_05 Visual Basic 2005 Basics 3 September 20th, 2006 10:10 AM
AutoIncrement in Insert on SQL Server 2K CarlosV SQL Server 2000 5 January 19th, 2006 06:01 PM
SQL Server 2k to XML using DTS Problem kwilliams SQL Server DTS 1 December 12th, 2005 12:11 PM
Professional SQL Server Development with Access 2K Fern All Other Wrox Books 0 January 29th, 2004 01:00 AM
Connectivity Problem To SQL Server 2k ctanchan Pro VB Databases 4 October 7th, 2003 11:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.