i cant tell really what the problem is but i get the following error oe ex.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim Connection As New Data.SqlClient.SqlConnection("C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\LugWdLib\LugWdLib\lugthes_source.sdf")
Dim Command As New SqlClient.SqlCommand ' declare a command to select from the database
Dim sqlselect As String
If (Connection.State = ConnectionState.Closed) Then ' open the connection to the database
Connection.Open()
End If
'connecting to database to seek for data
Command.Connection = Connection
sqlselect = "SELECT* FROM test WHERE id='" & writetext.Text & "'" 'command to search a word from the database
Dim check As System.Data.SqlClient.SqlDataAdapter = New System.Data.SqlClient.SqlDataAdapter(sqlselect, Connection)
Dim lugthes_source As DataSet = New DataSet()
check.Fill(lugthes_source, "word_name")
Dim numRow = lugthes_source.Tables("word_name").Rows.Count()
If (numRow > 1) Then
ListView1.Columns.Add("Ekigambo")
ListView1.Columns.Add("Kyekitegeeza")
ListView1.Columns.Add("Word")
ListView1.Columns.Add("Translated meaning")
ListView1.Columns.Add("Category")
Else
MessageBox.Show("temuli kigambo")
End If
While (numRow > 0)
Dim item As ListViewItem = ListView1.Items.Add(lugthes_source.Tables("word_name").Rows(0).ItemArray.GetValue(0).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(0).ItemArray.GetValue(1).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(1).ItemArray.GetValue(1).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(2).ItemArray.GetValue(1).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(3).ItemArray.GetValue(1).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(4).ItemArray.GetValue(1).ToString())
item.SubItems.Add(lugthes_source.Tables("word_name").Rows(5).ItemArray.GetValue(1).ToString())
End While
Catch ex As Exception
MessageBox.Show(ex.Message)
If (Connection.State = ConnectionState.Open) Then ' closes the connection to the database
End If
Connection.close()
Cursor.Current = Cursors.Default
End Try
If writetext.Text() = "" Then
MessageBox.Show(" You can't continue when the box is empty. PLease insert a word you want to search.")
Return
meaning.Show()
End If
End Sub