Ciao a tutti,
ho realizzato questa porzione di codice:
per eseguire una ricerca su di una tabella. Purtroppo però mi va in errore nel costrutto if dicendomi :codice:Dim sql As String sql = "SELECT * FROM tblMezzi WHERE targa = " & TextBox1.Text Dim conn As SqlCeConnection 'MySql.Data.MySqlClient.MySqlConnection 'mi connetto al DB conn = New SqlCeConnection conn.ConnectionString = "Data Source=|DataDirectory|\promotor.sdf" conn.Open() MsgBox("connessione aperta") 'sql query Dim myAdapter As New SqlCeDataAdapter Dim sqlquery = (sql) Dim myCommand As New SqlCeCommand myCommand.Connection = conn myCommand.CommandText = sqlquery 'Faccio partire la query myAdapter.SelectCommand = myCommand Dim myData As SqlCeDataReader myData = myCommand.ExecuteReader If myData.HasRows = 0 Then MsgBox("Query eseguita correttamente") Else MsgBox("Query eseguita correttamente") End If conn.Close()
SQL Server Compact non supporta chiamate alla proprietà HasRows se il cursore sottostante non è scorrevole.
Che cavolo vuol dire? Come faccio a fare una semplicissima ricerca?

Rispondi quotando