Error 3709 Vb 6.0
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ VB6 run-time error 3709 the connection cannot be used to perform the operation-it is either closed or invalid Rate this: Please Sign up or sign in to vote. See more: VB6 I always get this error everytime I ran the program. Dim rs As New ADODB.Recordset rs.Open "Select * From tbluser Where uname = '" & txtuser.Text & "'", cnn, adOpenStatic, adLockReadOnly If rs.RecordCount < 1 Then MsgBox "Invalid Username!", vbCritical, "Login Error" txtuser.SetFocus Exit Sub Else If txtpass.Text = rs!pword Then Unload Me Load Form2 Form2.Show Exit Sub Else MsgBox "Invalid Password!", vbCritical, "Login Error" txtpass.SetFocus Exit Sub End If End If Set rs = Nothing MODULE CODE: Option Explicit Public cnn As ADODB.Connection Public Sub getconnected() Set cnn = New ADODB.Connection cnn.CursorLocation = adUseClient cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Database1.mdb" & ";Persist Security Info=False;" cnn.Open End Sub THE HIGHLIGHTED CODE: rs.Open "Select * From tbluser Where uname = '" & txtuser.Text & "'", cnn, adOpenStatic, adLockReadOnly I just ad
? Ask a question, help others, and get answers from the community Discussions Start a thread and discuss today's topics with top experts Blogs Read the latest tech blogs written by experienced community members How to fix run-time error 3709 with my computer beginner1 5 pts. Tags: Thanks! We'll email youwhen relevant content isadded and updated. Following Follow Visual Basic 6 Thanks! We'll email youwhen relevant content isadded and updated. Following Follow Visual Basic Error Messages When I try to run my program http://www.codeproject.com/Questions/557798/VB-plusrun-timepluserrorplus-plustheplusconnect it says run-time error 3709 the connection cannot be used to perform this action, it is either closed or invalid in this context. mean while I used a module in which i put the following codes : Public cn As ADODB.Connection Public Sub Main() Dim cn As ADODB.Connection Set cn = New ADODB.Connection cn.ConnectionString = "C:UsersLab2c28DocumentsAuthors databaseauthors.mdb" cn.Open http://itknowledgeexchange.techtarget.com/itanswers/how-to-fix-run-time-error-3709-with-my-computer/ Form1.Show End Sub and then I put the following codes in a save button : Private Sub cmdsave_Click() Dim rsauthors As New ADODB.Recordset Set rsauthors = New ADODB.Recordset With rsauthors: ActiveConnection = cn Source = ("SElect * From authors") . LockType = adLockOptimistic Open End With With rsauthors: AddNew Fields("Book ID_") = Text1.Text Fields("Name") = Text2.Text Update End With End Sub Please help meSoftware/Hardware used: VB6 Asked: October 11, 20122:08 PM Last updated: October 24, 201312:21 PM Related Questions Error in Select Statement How to connect Access database to a Visual Studio 2005? Runtime error: server has not yet been opened Crystal reports Runtime error: server has not yet been opened Crystal reports Error when tried to update the SSOledbGrid connected to with Sybase Server Database Answer Wiki Last updated: October 24, 201312:21 PM GMT Ametuer30 pts. History Contributors Ordered by most recent Ametuer30 pts. Michael Tidmarsh48,715 pts. beginner15 pts. Thanks. We'll let you know when a new response is added. You could use something like i have done below.Public adoDatabase
8 Replies - 12768 Views - Last Post: 21 September 2012 - 07:19 AM Rate Topic: #1 thefifthhjohn New D.I.C http://www.dreamincode.net/forums/topic/289490-run-time-error-3709/ Head Reputation: 0 Posts: 11 Joined: 13-July 12 run time error 3709 Posted 20 August 2012 - 06:18 AM please help me I'm having error in rs.Open "SELECT * FROM [tbladmin] WHERE [username]= '" & txtUsername.Text & "'", con, adOpenStatic, adLockOptimistic I think my code is right I dunno where I went wrong. Dim strUserName error 3709 As String, strPassword As String Dim con As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub cmdlogin_Click() OpenCon rs.Open "SELECT * FROM [tbladmin] WHERE [username]= '" & txtUsername.Text & "'", con, adOpenStatic, adLockOptimistic If rs.RecordCount <> 0 Then If rs![Password] = txtPassword.Text Then If rs![user_type] = "Principal" Then MsgBox "The Principal has login", vbOKOnly + error 3709 vb vbInformation, "LOGIN" frmMain.Transaction.Visible = True frmMain.Maintenance.Visible = True frmMain.Reports.Visible = True frmMain.Exit.Visible = True frmMain.Others.Visible = True frmMain.Files.Visible = True Login1 = 1 'frmMain.Text3 = Text1.Text 'frmMain.Text4 = TimeValue(Now) End If End If End If End Sub Attached image(s) Is This A Good Question/Topic? 0 Back to top MultiQuote Quote + Reply Replies To: run time error 3709 #2 raziel_ Like a lollipop Reputation: 469 Posts: 4,265 Joined: 25-March 09 Re: run time error 3709 Posted 21 August 2012 - 12:42 PM the error says all. either you dont open your connection or the string for the connection is invalid. if you could show us the code where you open the connection we may give you better help Was This Post Helpful? 0 Back to top MultiQuote Quote + Reply #3 thefifthhjohn New D.I.C Head Reputation: 0 Posts: 11 Joined: 13-July 12 Re: run time error 3709 Posted 25 August 2012 - 06:53 PM raziel_, on 21 August 2012 - 12:42 PM, said