Results 1 to 2 of 2

Thread: plz help

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2007
    Posts
    1

    plz help

    i keep gettin the following error message The ConnectionString property has not been initialized

    this is my code

    Private Sub PopulateAgentListView()
    Dim dbConn As OleDb.OleDbConnection
    Dim dbCmd As OleDb.OleDbCommand
    Dim DataReader As OleDb.OleDbDataReader
    Dim SQLText As String = "SELECT * From tblAgent"

    dbConn = New OleDb.OleDbConnection
    dbCmd = New OleDb.OleDbCommand(SQLText, dbConn)

    dbConn.Open()
    DataReader = dbCmd.ExecuteReader()

    With DataReader
    Dim lv1Item As ListViewItem
    Do While .Read()
    lv1Item = New ListViewItem
    lv1Item.Text = DataReader.Item("AgentId")
    lv1Item.SubItems.Add(.Item("Agentname".ToString))
    lv1Item.SubItems.Add(.Item("Address1").ToString)
    lv1Item.SubItems.Add(.Item("Address2".ToString))
    lv1Item.SubItems.Add(.Item("Telephonenumber".ToStr ing))
    lv1Item.SubItems.Add(.Item("Faxnumber").ToString)
    lv1Item.SubItems.Add(.Item("Emailaddress").ToStrin g)


    Loop
    End With
    End Sub

    this is my app.config file code
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    </configSections>
    <connectionStrings>
    <add name="Pop_Concert.My.MySettings.databaseConnection String"
    connectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=|DataDirectory|\database.mdb"
    providerName="System.Data.OleDb" />
    </connectionStrings>
    <system.diagnostics>
    <sources>
    <!-- This section defines the logging configuration for My.Application.Log -->
    <source name="DefaultSource" switchName="DefaultSwitch">
    <listeners>
    <add name="FileLog"/>
    <!-- Uncomment the below section to write to the Application Event Log -->
    <!--<add name="EventLog"/>-->
    </listeners>
    </source>
    </sources>
    <switches>
    <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
    <add name="FileLog"
    type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
    initializeData="FileLogWriter"/>
    <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
    <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
    </system.diagnostics>
    </configuration>

    plz help

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: plz help

    Welcome to the Forums.

    You need to set the connectionstring property so it knows where your db is located and how to connect to it. Check out http://www.connectionstrings.com for the proper syntax for your type of database.

    Here is a good tutorial on ado.net - http://vbforums.com/showthread.php?t=466658
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width