Is this not the way to call a stored procedure?
I've commented out all of my sp's and can't find what is failing.Code:Private Sub SPRun() Dim oCmd As System.Data.SqlClient.SqlCommand Dim oDr As System.Data.SqlClient.SqlDataReader oCmd = New System.Data.SqlClient.SqlCommand Try With oCmd .Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx") .Connection.Open() .CommandType = CommandType.StoredProcedure .Parameters.AddWithValue("@payperiodstartdate", payperiodstartdate) .Parameters.AddWithValue("@payperiodenddate", payperiodenddate) .CommandText = "sp_opsum" oDr = .ExecuteReader() oCmd.Connection.Close() End With Catch ex As Exception MessageBox.Show(ex.Message) oCmd.Connection.Close() End Try




Reply With Quote