Caw. Program pracuje s databazou sql compact edition, a potreboval by som, aby ak pocet riadkov ktore vyhovuju dotazu na databazu je 0 aby program nespadol, resp. nevyhodil chybu. Dotaz:
Dim sqldotazhhmo As String = String.Format("SELECT [od],[vratane],[{0}] FROM [{1}]WHERE [od]<'" + TextBox1.Text + "' AND [H_D]='H' AND [vratane]>'" + TextBox1.Text + "' OR [vratane]='" + TextBox1.Text + "'", stu_presh, tol_poleh)
Pripojenie, vykonanie dotazu a vypis hladanej hodnoty.
con = New SqlCeConnection("Data Source=|DataDirectory|\tolerancie.sdf")
con.Open()
comhh = New SqlCeCommand(sqldotazhhmo, con)
Dim readerhh As SqlCeDataReader = comhh.ExecuteReader()
readerhh.Read()
readerhh.GetInt32(0).ToString()
readerhh.GetInt32(1).ToString()
hhmo.Text = readerhh.GetSqlSingle(2).ToString()
readerhh.Close()
|