A
aBsenT
I'm trying to bind a listview based on values in a treeview that has
letters of the alphabet as refrences. The code for the listview is as
follows :
'populate listbox
SqlCommand2.CommandText = " Where ClientName Like'" &
entry_letter & "%'"
SqlCommand2.Connection.Open()
myrdr = SqlCommand2.ExecuteReader(CommandBehavior.CloseConnection)
ListView1.Items.Clear()
Dim lstAdd As ListViewItem
i = 0
ListView1.Columns.Add("Name", 140, HorizontalAlignment.Left)
ListView1.Columns.Add("Address", 70, HorizontalAlignment.Left)
ListView1.Columns.Add("Phone", 70, HorizontalAlignment.Left)
Do While myrdr.Read
node_key = myrdr.GetString(1) & ", " & myrdr.GetString(2)
ListView1.Items(i).SubItems.Add(myrdr.GetString(3))
ListView1.Items(i).SubItems.Add(myrdr.GetString(5))
i += 1
Loop
myrdr.Close()
when I run a compile I get an Error : An unhandled exception of type
'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
I am new to VB.net and SQL server connections. If someone could either
point out my error in the code, or point me in the right way for an
example - Greatly appreciated.
thanx
aBsenT
letters of the alphabet as refrences. The code for the listview is as
follows :
'populate listbox
SqlCommand2.CommandText = " Where ClientName Like'" &
entry_letter & "%'"
SqlCommand2.Connection.Open()
myrdr = SqlCommand2.ExecuteReader(CommandBehavior.CloseConnection)
ListView1.Items.Clear()
Dim lstAdd As ListViewItem
i = 0
ListView1.Columns.Add("Name", 140, HorizontalAlignment.Left)
ListView1.Columns.Add("Address", 70, HorizontalAlignment.Left)
ListView1.Columns.Add("Phone", 70, HorizontalAlignment.Left)
Do While myrdr.Read
node_key = myrdr.GetString(1) & ", " & myrdr.GetString(2)
ListView1.Items(i).SubItems.Add(myrdr.GetString(3))
ListView1.Items(i).SubItems.Add(myrdr.GetString(5))
i += 1
Loop
myrdr.Close()
when I run a compile I get an Error : An unhandled exception of type
'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
I am new to VB.net and SQL server connections. If someone could either
point out my error in the code, or point me in the right way for an
example - Greatly appreciated.
thanx
aBsenT