|
-
Jun 17th, 2007, 05:17 PM
#1
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|