Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 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 Display Modes
  #1 (permalink)  
Old December 19th, 2011, 12:18 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile SQLOLEDB Connection Error

As Chapter 2 I tried to connect SQL Database using below connection string and that was not successful. I' using SQL 2005 Express edition and visual basic 2005 professional edition. My SQL Server Named Instants is ".\Local" and i already have database i was created named "cash". here is my code:

***** This Access Code is working and below SQL connection code not working *******


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strOleDbConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\Sagara\Documents\Visual Studio 2005\Projects\OleDB_Proj\ProjectTimeTracker.MDB;"
Dim Conn As OleDbConnection = New OleDbConnection(strOleDbConn)
Try
Conn.Open()
MsgBox(Conn.State.ToString)

Catch ex As Exception

Finally
Conn.Close()
MsgBox(Conn.State.ToString)
Conn.Dispose()
Conn = Nothing

End Try
End Sub


**** This is the code not working ********

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'TODO : Please Check with this code wrox forum
Dim strSQLOLE As String = "Provider=SQLOLEDB;Data Source=.\Local;Database=Cash;"
Dim Conn As OleDbConnection = New OleDbConnection(strSQLOLE)

Try
Conn.Open()
MsgBox(Conn.State.ToString)

Catch ex As Exception
MsgBox(ex.ToString)

Finally
Conn.Close()
MsgBox(Conn.State.ToString)
Conn.Dispose()
Conn = Nothing

End Try
End Sub
Reply With Quote
Reply


Thread Tools
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
Remote Connection Error: Named Pipes Provider error hbansal ASP.NET 2.0 Basics 5 April 12th, 2009 09:51 AM
DSN vs SQLOLEDB joemama SQL Server ASP 1 June 1st, 2006 03:46 PM
stored procedures and sqloledb terre SQL Server ASP 11 November 22nd, 2004 06:27 PM
sqloledb vs sqloledb.1 ckepford SQL Server ASP 3 November 9th, 2004 01:03 PM



All times are GMT -4. The time now is 09:26 AM.


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