This is my code.
VB Code:
Dim cn2 As New SqlClient.SqlConnection() cn2.ConnectionString = "Integrated Security=True;" & _ "Data Source=Brutus;Initial Catalog=Problem Tracking;" & _ "user id=user;password=pass;" cn2.Open() Dim commSQL2 As New SqlClient.SqlCommand() commSQL2.Connection = cn2 Dim datRead2 As SqlClient.SqlDataReader commSQL2.CommandText = "Select Count(Store Number) As Exp1 From Stores Order By [Store Number]" datRead2 = commSQL2.ExecuteReader
This causes the following error message:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
I tried it with a regular Select command like this.
This worked fine.VB Code:
commSQL2.CommandText = "Select [Store Number] From Stores Order By [Store Number]"
Anyone have any ideas why the select count statement is not working?
Thanks




Reply With Quote