I have created the sp but something is going on with the schema i think as its underlining red. i selected modify here so you could see the sp code. I manually ran select query to check rows exist
use Dictionary
select [word]
from [TblWords]
where [Word] = 'bioflex'
but when i call the visual basic code the object is returning no data the data is from a combo and the message box shows that looks ok but my call might not be:
Private Sub CBCWSelectedItems_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CBCWSelectedItems.SelectedIndexChanged Dim selectedIndex As Integer selectedIndex = CBCWSelectedItems.SelectedIndex Dim selectedItem As Object selectedItem = CBCWSelectedItems.SelectedItem MessageBox.Show("Selected Item Text: " & selectedItem.ToString() & Microsoft.VisualBasic.Constants.vbCrLf & "Index: " & selectedIndex.ToString()) ListMatrix.DataSource = GetMatrixData(selectedItem.ToString()).AsEnumerable().Select(Function(r) r.Field(Of String)("Word")).ToList() ListMatrix.Refresh() End Sub
Public Function GetMatrixData(ByVal StrWordIn As String) As DataTable Dim StrProcName As String Dim StrWord As String StrWord = StrWordIn dtMatrix = New DataTable Dim connectionString As String = ConfigurationManager.ConnectionStrings("Dictionary").ConnectionString If OpTag.Checked = True Then StrProcName = "usp_GetMatrix" Using connMatrix As New SqlConnection(connectionString) Using cmdMatrix As New SqlCommand(StrProcName, connMatrix) cmdMatrix.CommandType = CommandType.StoredProcedure connMatrix.Open() cmdMatrix.Parameters.AddWithValue("@WordVar", StrWord) Dim readerMatrix As SqlDataReader = cmdMatrix.ExecuteReader() dtMatrix.Load(readerMatrix) End Using End Using Return dtMatrix Else End If End Function
What is the value of 'OpTag.Checked' in the function GetMatrixData before SP is called?