swine 0 Posted October 9, 2012 Report Share Posted October 9, 2012 (edited) Hey there, I've already spent one day on this problem and still don't know what's wrong. I have a stored procedure giving me some project details. I want to save them into a list. So I created a project class.Using the SqlDataReader, I instantiate the project and put them in the list. Everything works fine, except one datafield. The values are always 0. But if I check the SQL, I'm getting the correct values. I really don't know, why this is happening. Dim cmd As New SqlCommandcmd.CommandText = "sao.GetProjects"cmd.CommandType = CommandType.StoredProcedurecmd.Connection = New SqlConnection(GetConnectionString)Using cmd.Connection Using cmd Dim projects As New List(Of clsProject) cmd.Connection.Open() Dim reader As SqlDataReader = cmd.ExecuteReader While reader.Read Dim project As New clsProjekt 'This is the field project.employeeNo = reader("employeeNo") 'Always get Empty If project.employeeNo = 0 Then Debug.Print("Empty") Else Debug.Print(project.employeeNo) End If project.orderNo = reader("OrderNo") project.description = reader("Description") project.customer = reader("Customer") projects.Add(project) End While End UsingEnd Using Thanks for helping Edited October 9, 2012 by swine Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.