473,729 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DSNLess Connection: VB 6 + SQL Server 2005

Dököll
2,364 Recognized Expert Top Contributor
Hiya Fans!

I hit a brick wall. I was attempting to make a DSNLess connection I seemed to have Goofed somewhere:

Expand|Select|Wrap|Line Numbers
  1. Private Sub SQLServer_Click()
  2. Dim MyWorkspace As DAO.Workspace
  3. Set MyWorkspace = CreateWorkspace("", "admin", "", dbUseODBC)
  4. Dim MyConnection As DAO.Connection
  5. Set MyConnection = MyWorkspace.OpenConnection("", , , "ODBC;DATABASE=FirstSQLDB")
  6. Dim rec_set As DAO.Recordset
  7. Dim MSSQL As String
  8. MSSQL = "SELECT * FROM Email WHERE EmailAddress ='" & Text1(0).Text & "'"""
  9. Set rec_set = MyWorkspace.OpenRecordset(MSSQL)
  10. Do While Not rec_set.EOF  'this function will keep searching for fields matching each textbox
  11.    'MsgBox ("got here")
  12.         Text1(0).Text = rec_set.fields("EmailAddress")
  13.         Text1(1).Text = rec_set.fields("IPAddress")
  14.         Text1(2).Text = rec_set.fields("DateTimeStamp")
  15.         Text1(3).Text = rec_set.fields("EmailID")       
  16.    rec_set.MoveNext
  17.    Loop
  18.    MyWorkspace.Close
  19.    rec_set.Close
  20.  
  21.  
Trying to grab data out of SQL Server database using DAO with ODBC connection, new to ODBC, have made one fancy connection in the past, forgot it all.

I get a pop up requesting I add DSN name or other...

What do you see?

In a bit!

Dököll
Jan 13 '08 #1
8 4252
Killer42
8,435 Recognized Expert Expert
To be honest, Dököll, I think msquared, NeoPa and the other gurus in the Access forum are likely to be more helpful on this one.
Jan 15 '08 #2
QVeen72
1,445 Recognized Expert Top Contributor
Hi Dököll

ODBC Connection string for DAO is something like this ::

"ODBC;DSN=MYODB CNAME;UID=MYNAM E;PWD=MYPASSWOR D;DBQ=DATABASEN AME;"

Not very sure, if you can connect SQL2005 using DAO in VB6..
use ADO, instead of DAO..

Regards
Veena
Jan 15 '08 #3
Dököll
2,364 Recognized Expert Top Contributor
Hello, Guys!

Funny you mentioned Killer42, got a similar post out there on this and msquared has come to aid, waiting to hear from her on a bit of info I stumbled upon. Thanks for your input. Truth is Veena and msquared are right on target, so thank you also, Veena.

Picked up some books at the library, seem to lead where you're at. Seems to be stearing to ADO instead also. I hope to nail it good with ODBC though:-)

Will tell you what comes out of it...

In a bit guys, thanks!

By the way, Killer42, looks like you got your avatar back. Good!

Dököll
Jan 22 '08 #4
Killer42
8,435 Recognized Expert Expert
Yeah, I figured I would never find the time to update that radar one so went back to something more interesting.
Jan 22 '08 #5
QVeen72
1,445 Recognized Expert Top Contributor
Hi DoKoll,

Try This M$ Example

Regards
Veena
Jan 22 '08 #6
debasisdas
8,127 Recognized Expert Expert
try the use the following sample code

This is for DSN less connection to Oracle using RDO.

Expand|Select|Wrap|Line Numbers
  1. Dim RS As rdoResultset
  2. Dim Cn As rdoConnection
  3. Dim En As rdoEnvironment
  4. Dim Conn As String
  5.  
  6. Private Sub Form_Load()
  7. Set En = rdoEnvironments(0)
  8. Conn = "UID=SCOTT;PWD=TIGER;" _
  9.    & "DATABASE=ORCL;" _
  10.    & "SERVER=ORCL;" _
  11.    & "DRIVER={ORACLE IN ORADB10G_HOME1};DSN='';"
  12. Set Cn = En.OpenConnection(dsName:="", _
  13.    Prompt:=rdDriverNoPrompt, Connect:=Conn)
  14. Set RS = Cn.OpenResultset("SELECT * FROM EMP")
  15. Call DISP
  16. End Sub
  17.  
Jan 22 '08 #7
lotus18
866 Contributor
This would be helpful : ). Keep up the good work experts!

Rey Sean
Jan 22 '08 #8
Dököll
2,364 Recognized Expert Top Contributor
This would be helpful : ). Keep up the good work experts!

Rey Sean
Super appreciate it, truly...

Sorry to have been away from this post. I will try your examples. I believe msquared said should be too far from VBA. Will try and see:-)

What outpouring support guys, thanks!!!

Dököll
Jan 28 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2229
by: shank | last post by:
I'm trying to setup an Access DSNLess connection on my local computer. The following string works fine within the Dreamweaver interface. But when I upload to my server (locally) I get this error. Can anyone lend some insight? thanks Object required: 'oConn' /Connections/conn.asp, line 2 <%
2
4342
by: Tony Epton | last post by:
<crossposted to several groups> Is there any way to create a DSNless connection to SQL server from access 97 (DAO) All the samples of connection strings I am finding - all have a reference to a DSN. Many thanks Tony
17
9237
by: Danieltbt05 | last post by:
just installed SQL server 2000 and using my client , i can't locate the server. I used SQL query analyzer to search but no servers were found. Error message is as below Server : Msg17,level 16, state1 SQL server does not exist or denied access.
4
9739
by: MrsBean | last post by:
I've been working on learning how to use PHP with MS Access, and as long as I use ODBC, I can make it work. I want to use a DSNless connection. Everthing I have tried has failed. Can anyone show me a simple example? MrsBean
16
2867
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with a worker thread that would execute the db commands. The pool was fixed and all the connections were created when the db access class was instantiated. The connections remained opened during the whole execution. If a connection was not available...
3
13359
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. On Windows XP Pro, I am using MS Visual Studio 2005, and I am using the developer's edition of...
20
3289
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
4
3408
by: matthooper | last post by:
Hello all, I have this peice of code that connects to a SQL server without the DSN Dim cn As ADODB.Connection Dim rs As ADODB.Recordset 'Create a new ADO Connection object Set cn = New ADODB.Connection
2
4962
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express Edition" via the link on: http://msdn2.microsoft.com/en-us/express/bb410792.aspx
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.