c# - SqlCommand read one value -


i have problem value returned sqlcommand, have code:

string sqlselect = "select top 1 quotation.senttosupp senttosupp quotation join notifications on quotation.quotationid = quotationid ";  sqlcommand comm = new sqlcommand(sqlselect, this.connection); 

sqlselect query selects first datetime value. when call sqlcommand want value (just 1 value). add query , connection fine.

but don't know how datetime value... must use executereader?

thank in advance!!

use sqlcommand.executescalar method - executes query, , returns first column of first row in result set returned query. additional columns or rows ignored.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -