Executereader: свойство commandtext не было инициализировано
ExecuteReader: CommandText property has not been initialized
Что я уже пробовал:
Dim cnn1 As SqlConnection Dim cmd1 As SqlCommand Dim reader1 As SqlDataReader connetionString = ConfigurationManager.ConnectionStrings("APMCUBIntranetConnectionString").ConnectionString cnn1 = New SqlConnection(connetionString) cnn1.Open() cmd1 = New SqlCommand(Sql1, cnn1) Sql1 = "SELECT Count([Questions]) As Tq, SUM(case when [Compliance]= 'Yes ' then 1 else 0 end) As Yes, sum(case when [Compliance]= 'No ' then 1 else 0 end) As No,Sum(case when [Compliance]= 'NA ' then 1 else 0 end) As NA, (Count ([Questions]) - Sum(case when [Compliance]= 'NA ' then 1 else 0 end)) As Net FROM [APMCUBIntranet].[dbo].[AuditChaptHo] where Branch = '" & DropDownList6.Text & "' and Chapter ='CREDIT MANAGEMENT' and SubChap1 ='A.Common Observations' and convert(datetime,AuditStDt,103) between convert(datetime, '" & strDate1 & "',103) and convert(datetime,'" & strDate2 & "',103) " reader1 = cmd1.ExecuteReader() While (reader1.Read()) LblTQ1.Text = reader1(0) LblNA1.Text = reader1(3) LblNet1.Text = reader1(4) LblYes1.Text = reader1(1) LblMks1.Text = reader1(1) End While cnn1.Close() reader1.Close()