Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 14th, 2007, 09:25 AM
Authorized User
 
Join Date: Oct 2007
Location: doncaster, , United Kingdom.
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to debbiecoates
Default dao connection to sql

can anyone point me in the right direction, having spent the past 3 hours looking at this, I am going up the wall.

I am working on a database that someone else has set up. the vb front end is connection to SQL 2000, using a DSN.

its been set up so that the database connection is created once, and from there on other stuff is issued against it.

God knows how the ins and outs work, its a nightmare. the trouble is I am trying to develope 2 new forms unfortunately they wont appear in the database until loads of other stuff has been done, so I was trying to isolate my one page to test it (otherwise its a nightmare opening a vb project with 100+ forms before mine)

so, i have declared a public variable
Public dbGams As DAO.Database


then I open the database, i am not sure if i have this right, I have a DSN on my machine that is pointed to the database which works fine, not sure how to call it.

Public Function dbOpenMain() As Boolean
Set dbGams = OpenDatabase("Gams", dbDriverNoPrompt, False, "ODBC;DSN=Gams;Driver={SQL Server};Server=(Local);Database=txtDatabase;UID=tx tUID;pwd=txtPassword;")
End Function

and this function should allow me to create a recodset by calling

dim rNew as dao.recordset
set rnew = Openrecordset(dbGams, "Select * from Customers")

Public Function OpenRecordset(oDB As Database, ssql As String, Optional bEdit As Boolean = True) As Object
Dim rs As Recordset
Set rs = dbGams.OpenRecordset(ssql, dbOpenDynaset, dbSeeChanges, dbOptimistic)
end function


would be gratefull for any input

Reply With Quote
  #2 (permalink)  
Old November 14th, 2007, 10:10 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. this doesn't look bad.. what's your problem??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DAO and ADO within ADODB.connection faridrd Access VBA 0 January 8th, 2008 10:43 PM
how to convert this DAO connection code to ADO Con ruth26 VB Databases Basics 0 May 11th, 2006 05:15 AM
Convert ADO connection to DAO database dr_morose Access VBA 0 November 17th, 2004 05:44 PM
Connect query w/ database(dao dsnless connection) omnicap1 Access VBA 0 August 23rd, 2004 01:50 PM
Connect query w/ database(dao dsnless connection) omnicap1 Access VBA 0 August 23rd, 2004 01:48 PM



All times are GMT -4. The time now is 10:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.