Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 August 21st, 2006, 03:02 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default MySQL V.Net Connection property has not been initi

G'day
Can anyone help me as to why this does not work?
Thanks if you can
Dim Conn As OdbcConnection
        Dim sConn As String
        Dim Cmd As OdbcCommand
        Dim Rd As OdbcDataReader
        Dim strSQL As String
        strSQL = "select namemain from en_tblentities"
        Conn = New OdbcConnection
        sConn = "DRIVER={MySQL ODBC 3.51

Driver};SERVER=localhost;DATABASE=test;USER=root;P ASSWORD=thewiggles;option=3"
        Conn.ConnectionString = sConn
        Conn.Open()
        Cmd = New OdbcCommand
        Cmd.CommandText = strSQL

        Rd = Cmd.ExecuteReader
        While Rd.Read
            s = s & "<BR>" & Rd("namemain")
        End While
        Response.Write(s)
    ........

ExecuteReader: Connection property has not been initialized.
Description: An unhandled exception occurred during the execution of the current

web request. Please review the stack trace for more information about the error and

where it originated in the code.

Exception Details: System.InvalidOperationException: ExecuteReader: Connection

property has not been initialized.

Source Error:


Line 46: Cmd.CommandText = strSQL
Line 47:
Line 48: Rd = Cmd.ExecuteReader
Line 49: While Rd.Read
Line 50: s = s & "<BR>" & Rd("NameMain")


Source File: D:\TestProj\IN_Investments\frmTestMySQL.aspx.vb Line: 48






Similar Threads
Thread Thread Starter Forum Replies Last Post
ExecuteReader: Connection property has not been in Follie Visual Studio 2005 3 October 14th, 2008 04:06 AM
c# connection string for .Net 1.1 with Mysql srkarthik_82 General .NET 0 January 17th, 2007 06:58 AM
Connection property has not been initialized sasi.vempalli ASP.NET 1.0 and 1.1 Basics 0 September 19th, 2006 03:03 AM
Connection Property:Has not been initialized louie001 ASP.NET 1.0 and 1.1 Basics 1 October 17th, 2005 11:46 PM
ASP.NET database connection MySQL socoolbrewster ASP.NET 1.0 and 1.1 Basics 3 November 21st, 2003 07:12 PM





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