>>SqlConnection conn = new SqlConnection(this.GetConnectionString("PantryWare")); >> >> >>SqlCommand cmd = new SqlCommand(); >>object newVal; >>cmd.CommandText = "dbo.GetNextNumber"; >>cmd.CommandType = CommandType.StoredProcedure; >>SqlParameter param = new SqlParameter("@NextNumber", "0000000000"); >>param.Direction = ParameterDirection.Output; >>cmd.Parameters.Add(param); >>cmd.Connection = conn; >>conn.Open(); >> >>newVal = cmd.ExecuteScalar(); >>conn.Close(); >> >>string myNumber = newVal.ToString(); >>>>
>string myNumber = cmd.Parameters("@NextNumber").Value.ToString();I tried that earlier and I just tried again with the SQL native code. The parameter visible name is @NextNumber and its value is 0