I am getting this error when I debug my application on my Vista box at home. I do not get it when running on my XP box at work. I know the error is indicative of converting strings to integers but I can't see where I am going wrong, much less why it only afflicts my Vista machine! I am using Visual Basic 2008 Express on both computers.
Anyone have any ideas, has had me stumped for a couple days now
Here is some code:
..........
......
Here is the function being called:
Here is the SQL statement that is used:
Anyone have any ideas, has had me stumped for a couple days now
Here is some code:
..........
VB.NET:
Dim Count As Integer = 0
Try
Count = DataAccess.ReturnTotalSearchRowCount("")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
lbl_TotalSongCount.Text = "Library contains " & Convert.ToString(Count) & " total records"
......
Here is the function being called:
VB.NET:
Public Shared Function ReturnTotalSearchRowCount(ByVal SearchCrit As String) As Integer
Dim conn As New SqlServerCe.SqlCeConnection("Data Source = Database1.sdf")
'''Stop
Dim result As Integer = 0
Dim inc As Integer = 0
'Declare and instantiate a DataSet
Dim ds As New Data.DataSet()
Dim SQL_Com As New SqlServerCe.SqlCeCommand(SQL_Queries.CountSearchResults, conn)
SQL_Com.Parameters.AddWithValue("CRIT", SearchCrit)
Dim da As New SqlServerCe.SqlCeDataAdapter(SQL_Com)
da.Fill(ds) <----<----------------------It's failing here
If ds.Tables(0).Rows.Count > 0 Then
result = ds.Tables(0).Rows(0).Item(0)
Else
result = 0
End If
conn.Close()
conn.Dispose()
Return result
End Function
VB.NET:
"SELECT COUNT(ID) FROM Songs WHERE (Artist LIKE '%' + @CRIT + '%') OR (TrackName LIKE '%' + @CRIT + '%') OR (ShortFileName LIKE '%' + @CRIT + '%') OR (Album LIKE '%' + @CRIT + '%')"